diff --git a/plugin/trino-hive/src/main/java/io/trino/plugin/hive/SystemTableProvider.java b/lib/trino-plugin-toolkit/src/main/java/io/trino/plugin/base/connector/SystemTableProvider.java similarity index 79% rename from plugin/trino-hive/src/main/java/io/trino/plugin/hive/SystemTableProvider.java rename to lib/trino-plugin-toolkit/src/main/java/io/trino/plugin/base/connector/SystemTableProvider.java index 0ae51c91db15..5f95dd50bf5c 100644 --- a/plugin/trino-hive/src/main/java/io/trino/plugin/hive/SystemTableProvider.java +++ b/lib/trino-plugin-toolkit/src/main/java/io/trino/plugin/base/connector/SystemTableProvider.java @@ -11,8 +11,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.trino.plugin.hive; +package io.trino.plugin.base.connector; +import io.trino.spi.connector.ConnectorMetadata; import io.trino.spi.connector.ConnectorSession; import io.trino.spi.connector.SchemaTableName; import io.trino.spi.connector.SystemTable; @@ -23,5 +24,5 @@ public interface SystemTableProvider { Optional getSourceTableName(SchemaTableName table); - Optional getSystemTable(HiveMetadata metadata, ConnectorSession session, SchemaTableName tableName); + Optional getSystemTable(ConnectorMetadata metadata, ConnectorSession session, SchemaTableName tableName); } diff --git a/plugin/trino-delta-lake/src/main/java/io/trino/plugin/deltalake/DeltaLakeModule.java b/plugin/trino-delta-lake/src/main/java/io/trino/plugin/deltalake/DeltaLakeModule.java index 3026b015b3e4..c93e1809d904 100644 --- a/plugin/trino-delta-lake/src/main/java/io/trino/plugin/deltalake/DeltaLakeModule.java +++ b/plugin/trino-delta-lake/src/main/java/io/trino/plugin/deltalake/DeltaLakeModule.java @@ -22,6 +22,7 @@ import com.google.inject.multibindings.Multibinder; import io.airlift.configuration.AbstractConfigurationAwareModule; import io.trino.filesystem.cache.CacheKeyProvider; +import io.trino.plugin.base.connector.SystemTableProvider; import io.trino.plugin.base.security.ConnectorAccessControlModule; import io.trino.plugin.base.session.SessionPropertiesProvider; import io.trino.plugin.deltalake.cache.DeltaLakeCacheKeyProvider; @@ -49,7 +50,6 @@ import io.trino.plugin.deltalake.transactionlog.writer.TransactionLogWriterFactory; import io.trino.plugin.hive.FileFormatDataSourceStats; import io.trino.plugin.hive.PropertiesSystemTableProvider; -import io.trino.plugin.hive.SystemTableProvider; import io.trino.plugin.hive.metastore.thrift.TranslateHiveViews; import io.trino.plugin.hive.parquet.ParquetReaderConfig; import io.trino.plugin.hive.parquet.ParquetWriterConfig; diff --git a/plugin/trino-hive/src/main/java/io/trino/plugin/hive/HiveConnectorFactory.java b/plugin/trino-hive/src/main/java/io/trino/plugin/hive/HiveConnectorFactory.java index 4fcc498fa561..503b2443cd0f 100644 --- a/plugin/trino-hive/src/main/java/io/trino/plugin/hive/HiveConnectorFactory.java +++ b/plugin/trino-hive/src/main/java/io/trino/plugin/hive/HiveConnectorFactory.java @@ -33,6 +33,7 @@ import io.trino.plugin.base.classloader.ClassLoaderSafeConnectorPageSourceProvider; import io.trino.plugin.base.classloader.ClassLoaderSafeConnectorSplitManager; import io.trino.plugin.base.classloader.ClassLoaderSafeNodePartitioningProvider; +import io.trino.plugin.base.connector.SystemTableProvider; import io.trino.plugin.base.jmx.ConnectorObjectNameGeneratorModule; import io.trino.plugin.base.jmx.MBeanServerModule; import io.trino.plugin.base.session.SessionPropertiesProvider; diff --git a/plugin/trino-hive/src/main/java/io/trino/plugin/hive/HiveMetadata.java b/plugin/trino-hive/src/main/java/io/trino/plugin/hive/HiveMetadata.java index 46f4a9c0a1a1..c38ad6cfcefd 100644 --- a/plugin/trino-hive/src/main/java/io/trino/plugin/hive/HiveMetadata.java +++ b/plugin/trino-hive/src/main/java/io/trino/plugin/hive/HiveMetadata.java @@ -48,6 +48,7 @@ import io.trino.metastore.StorageFormat; import io.trino.metastore.Table; import io.trino.metastore.TableInfo; +import io.trino.plugin.base.connector.SystemTableProvider; import io.trino.plugin.base.projection.ApplyProjectionUtil; import io.trino.plugin.base.projection.ApplyProjectionUtil.ProjectedColumnRepresentation; import io.trino.plugin.hive.HiveSessionProperties.InsertExistingPartitionsBehavior; diff --git a/plugin/trino-hive/src/main/java/io/trino/plugin/hive/HiveMetadataFactory.java b/plugin/trino-hive/src/main/java/io/trino/plugin/hive/HiveMetadataFactory.java index 0f46aee01f12..198f9f69fbdc 100644 --- a/plugin/trino-hive/src/main/java/io/trino/plugin/hive/HiveMetadataFactory.java +++ b/plugin/trino-hive/src/main/java/io/trino/plugin/hive/HiveMetadataFactory.java @@ -20,6 +20,7 @@ import io.airlift.units.Duration; import io.trino.filesystem.TrinoFileSystemFactory; import io.trino.metastore.HiveMetastore; +import io.trino.plugin.base.connector.SystemTableProvider; import io.trino.plugin.hive.fs.DirectoryLister; import io.trino.plugin.hive.fs.TransactionScopeCachingDirectoryListerFactory; import io.trino.plugin.hive.metastore.HiveMetastoreConfig; diff --git a/plugin/trino-hive/src/main/java/io/trino/plugin/hive/HiveModule.java b/plugin/trino-hive/src/main/java/io/trino/plugin/hive/HiveModule.java index af24f09cc109..5d82949397dc 100644 --- a/plugin/trino-hive/src/main/java/io/trino/plugin/hive/HiveModule.java +++ b/plugin/trino-hive/src/main/java/io/trino/plugin/hive/HiveModule.java @@ -22,6 +22,7 @@ import com.google.inject.Singleton; import com.google.inject.multibindings.Multibinder; import io.airlift.event.client.EventClient; +import io.trino.plugin.base.connector.SystemTableProvider; import io.trino.plugin.hive.avro.AvroFileWriterFactory; import io.trino.plugin.hive.avro.AvroPageSourceFactory; import io.trino.plugin.hive.fs.CachingDirectoryLister; diff --git a/plugin/trino-hive/src/main/java/io/trino/plugin/hive/PartitionsSystemTableProvider.java b/plugin/trino-hive/src/main/java/io/trino/plugin/hive/PartitionsSystemTableProvider.java index 0706404cfec9..e878636ddd68 100644 --- a/plugin/trino-hive/src/main/java/io/trino/plugin/hive/PartitionsSystemTableProvider.java +++ b/plugin/trino-hive/src/main/java/io/trino/plugin/hive/PartitionsSystemTableProvider.java @@ -15,7 +15,9 @@ import com.google.inject.Inject; import io.trino.metastore.Table; +import io.trino.plugin.base.connector.SystemTableProvider; import io.trino.spi.connector.ColumnMetadata; +import io.trino.spi.connector.ConnectorMetadata; import io.trino.spi.connector.ConnectorSession; import io.trino.spi.connector.ConnectorTableMetadata; import io.trino.spi.connector.Constraint; @@ -67,8 +69,9 @@ public Optional getSourceTableName(SchemaTableName tableName) } @Override - public Optional getSystemTable(HiveMetadata metadata, ConnectorSession session, SchemaTableName tableName) + public Optional getSystemTable(ConnectorMetadata connectorMetadata, ConnectorSession session, SchemaTableName tableName) { + HiveMetadata metadata = (HiveMetadata) connectorMetadata; if (!PARTITIONS.matches(tableName)) { return Optional.empty(); } diff --git a/plugin/trino-hive/src/main/java/io/trino/plugin/hive/PropertiesSystemTableProvider.java b/plugin/trino-hive/src/main/java/io/trino/plugin/hive/PropertiesSystemTableProvider.java index 1abccf410252..a9e3665002d0 100644 --- a/plugin/trino-hive/src/main/java/io/trino/plugin/hive/PropertiesSystemTableProvider.java +++ b/plugin/trino-hive/src/main/java/io/trino/plugin/hive/PropertiesSystemTableProvider.java @@ -16,7 +16,9 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSortedMap; import io.trino.metastore.Table; +import io.trino.plugin.base.connector.SystemTableProvider; import io.trino.spi.connector.ColumnMetadata; +import io.trino.spi.connector.ConnectorMetadata; import io.trino.spi.connector.ConnectorSession; import io.trino.spi.connector.ConnectorTableMetadata; import io.trino.spi.connector.InMemoryRecordSet; @@ -50,8 +52,9 @@ public Optional getSourceTableName(SchemaTableName tableName) } @Override - public Optional getSystemTable(HiveMetadata metadata, ConnectorSession session, SchemaTableName tableName) + public Optional getSystemTable(ConnectorMetadata connectorMetadata, ConnectorSession session, SchemaTableName tableName) { + HiveMetadata metadata = (HiveMetadata) connectorMetadata; if (!PROPERTIES.matches(tableName)) { return Optional.empty(); } diff --git a/plugin/trino-hive/src/main/java/io/trino/plugin/hive/security/SystemTableAwareAccessControl.java b/plugin/trino-hive/src/main/java/io/trino/plugin/hive/security/SystemTableAwareAccessControl.java index c9a1a32c2806..6c15a05a1603 100644 --- a/plugin/trino-hive/src/main/java/io/trino/plugin/hive/security/SystemTableAwareAccessControl.java +++ b/plugin/trino-hive/src/main/java/io/trino/plugin/hive/security/SystemTableAwareAccessControl.java @@ -17,8 +17,8 @@ import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import com.google.inject.Inject; +import io.trino.plugin.base.connector.SystemTableProvider; import io.trino.plugin.base.security.ForwardingConnectorAccessControl; -import io.trino.plugin.hive.SystemTableProvider; import io.trino.spi.connector.ConnectorAccessControl; import io.trino.spi.connector.ConnectorSecurityContext; import io.trino.spi.connector.SchemaTableName; diff --git a/plugin/trino-hive/src/main/java/io/trino/plugin/hive/util/SystemTables.java b/plugin/trino-hive/src/main/java/io/trino/plugin/hive/util/SystemTables.java index 8ca52182b1a2..b2bf5ff1564a 100644 --- a/plugin/trino-hive/src/main/java/io/trino/plugin/hive/util/SystemTables.java +++ b/plugin/trino-hive/src/main/java/io/trino/plugin/hive/util/SystemTables.java @@ -14,7 +14,7 @@ package io.trino.plugin.hive.util; -import io.trino.plugin.hive.SystemTableProvider; +import io.trino.plugin.base.connector.SystemTableProvider; import io.trino.spi.connector.ConnectorSession; import io.trino.spi.connector.ConnectorTableMetadata; import io.trino.spi.connector.ConnectorTransactionHandle;