diff --git a/docs/src/main/sphinx/connector/hive.rst b/docs/src/main/sphinx/connector/hive.rst index bfe8bf118c9e..c6c635551a37 100644 --- a/docs/src/main/sphinx/connector/hive.rst +++ b/docs/src/main/sphinx/connector/hive.rst @@ -114,11 +114,11 @@ logic and data encoded in the views is not available in Trino. A very simple implementation to execute Hive views, and therefore allow read access to the data in Trino, can be enabled with -``hive.translate-hive-views=true`` and -``hive.legacy-hive-view-translation=true``. +``hive.hive-views.enabled=true`` and +``hive.hive-views.legacy-translation=true``. For temporary usage of the legacy behavior for a specific catalog, you can set -the ``legacy_hive_view_translation`` :doc:`catalog session property +the ``hive_views_legacy_translation`` :doc:`catalog session property ` to ``true``. This legacy behavior interprets any HiveQL query that defines a view as if it @@ -147,8 +147,8 @@ It supports the following Hive view functionality: * ``LATERAL VIEW json_tuple`` You can enable the experimental behavior with -``hive.translate-hive-views=true``. Remove the -``hive.legacy-hive-view-translation`` property or set it to ``false`` to make +``hive.hive-views.enabled=true``. Remove the +``hive.hive-views.legacy-translation`` property or set it to ``false`` to make sure legacy is not enabled. Keep in mind that numerous features are not yet implemented when experimenting @@ -373,11 +373,11 @@ Property Name Description is used for write operations. The ``${USER}`` placeholder can be used to use a different location for each user. -``hive.translate-hive-views`` Enable translation for :ref:`Hive views `. ``false`` +``hive.hive-views.enabled`` Enable translation for :ref:`Hive views `. ``false`` -``hive.legacy-hive-view-translation`` Use the legacy algorithm to translate ``false`` +``hive.hive-views.legacy-translation`` Use the legacy algorithm to translate ``false`` :ref:`Hive views `. You can use the - ``legacy_hive_view_translation`` catalog session property + ``hive_views_legacy_translation`` catalog session property for temporary, catalog specific use. ``hive.parallel-partitioned-bucketed-writes`` Improve parallelism of partitioned and bucketed table ``true`` diff --git a/plugin/trino-hive/src/main/java/io/trino/plugin/hive/HiveConfig.java b/plugin/trino-hive/src/main/java/io/trino/plugin/hive/HiveConfig.java index e37811ce1240..76be40bc3070 100644 --- a/plugin/trino-hive/src/main/java/io/trino/plugin/hive/HiveConfig.java +++ b/plugin/trino-hive/src/main/java/io/trino/plugin/hive/HiveConfig.java @@ -144,6 +144,7 @@ public class HiveConfig private long perTransactionFileStatusCacheMaximumSize = 1000 * 1000; private boolean translateHiveViews; + private boolean legacyHiveViewTranslation; private Optional hiveTransactionHeartbeatInterval = Optional.empty(); private int hiveTransactionHeartbeatThreads = 5; @@ -160,7 +161,6 @@ public class HiveConfig private boolean optimizeSymlinkListing = true; - private boolean legacyHiveViewTranslation; private Optional icebergCatalogName = Optional.empty(); private DataSize targetMaxFileSize = DataSize.of(1, GIGABYTE); @@ -767,8 +767,8 @@ public boolean isTranslateHiveViews() return translateHiveViews; } - @LegacyConfig("hive.views-execution.enabled") - @Config("hive.translate-hive-views") + @LegacyConfig({"hive.views-execution.enabled", "hive.translate-hive-views"}) + @Config("hive.hive-views.enabled") @ConfigDescription("Experimental: Allow translation of Hive views into Trino views") public HiveConfig setTranslateHiveViews(boolean translateHiveViews) { @@ -776,6 +776,20 @@ public HiveConfig setTranslateHiveViews(boolean translateHiveViews) return this; } + public boolean isLegacyHiveViewTranslation() + { + return this.legacyHiveViewTranslation; + } + + @LegacyConfig("hive.legacy-hive-view-translation") + @Config("hive.hive-views.legacy-translation") + @ConfigDescription("Use legacy Hive view translation mechanism") + public HiveConfig setLegacyHiveViewTranslation(boolean legacyHiveViewTranslation) + { + this.legacyHiveViewTranslation = legacyHiveViewTranslation; + return this; + } + public long getFileStatusCacheMaxSize() { return fileStatusCacheMaxSize; @@ -1129,19 +1143,6 @@ public HiveConfig setOptimizeSymlinkListing(boolean optimizeSymlinkListing) return this; } - @Config("hive.legacy-hive-view-translation") - @ConfigDescription("Use legacy Hive view translation mechanism") - public HiveConfig setLegacyHiveViewTranslation(boolean legacyHiveViewTranslation) - { - this.legacyHiveViewTranslation = legacyHiveViewTranslation; - return this; - } - - public boolean isLegacyHiveViewTranslation() - { - return this.legacyHiveViewTranslation; - } - public Optional getIcebergCatalogName() { return icebergCatalogName; diff --git a/plugin/trino-hive/src/main/java/io/trino/plugin/hive/HiveSessionProperties.java b/plugin/trino-hive/src/main/java/io/trino/plugin/hive/HiveSessionProperties.java index 0559c14510f3..920332a158e1 100644 --- a/plugin/trino-hive/src/main/java/io/trino/plugin/hive/HiveSessionProperties.java +++ b/plugin/trino-hive/src/main/java/io/trino/plugin/hive/HiveSessionProperties.java @@ -111,7 +111,7 @@ public final class HiveSessionProperties private static final String PARQUET_OPTIMIZED_WRITER_ENABLED = "experimental_parquet_optimized_writer_enabled"; private static final String DYNAMIC_FILTERING_WAIT_TIMEOUT = "dynamic_filtering_wait_timeout"; private static final String OPTIMIZE_SYMLINK_LISTING = "optimize_symlink_listing"; - private static final String LEGACY_HIVE_VIEW_TRANSLATION = "legacy_hive_view_translation"; + private static final String HIVE_VIEWS_LEGACY_TRANSLATION = "hive_views_legacy_translation"; private static final String ICEBERG_CATALOG_NAME = "iceberg_catalog_name"; public static final String SIZE_BASED_SPLIT_WEIGHTS_ENABLED = "size_based_split_weights_enabled"; public static final String MINIMUM_ASSIGNED_SPLIT_WEIGHT = "minimum_assigned_split_weight"; @@ -461,7 +461,7 @@ public HiveSessionProperties( hiveConfig.isOptimizeSymlinkListing(), false), booleanProperty( - LEGACY_HIVE_VIEW_TRANSLATION, + HIVE_VIEWS_LEGACY_TRANSLATION, "Use legacy Hive view translation mechanism", hiveConfig.isLegacyHiveViewTranslation(), false), @@ -794,9 +794,9 @@ public static boolean isOptimizeSymlinkListing(ConnectorSession session) return session.getProperty(OPTIMIZE_SYMLINK_LISTING, Boolean.class); } - public static boolean isLegacyHiveViewTranslation(ConnectorSession session) + public static boolean isHiveViewsLegacyTranslation(ConnectorSession session) { - return session.getProperty(LEGACY_HIVE_VIEW_TRANSLATION, Boolean.class); + return session.getProperty(HIVE_VIEWS_LEGACY_TRANSLATION, Boolean.class); } public static Optional getIcebergCatalogName(ConnectorSession session) diff --git a/plugin/trino-hive/src/main/java/io/trino/plugin/hive/ViewReaderUtil.java b/plugin/trino-hive/src/main/java/io/trino/plugin/hive/ViewReaderUtil.java index 7e9597aac98e..492d9261078a 100644 --- a/plugin/trino-hive/src/main/java/io/trino/plugin/hive/ViewReaderUtil.java +++ b/plugin/trino-hive/src/main/java/io/trino/plugin/hive/ViewReaderUtil.java @@ -50,7 +50,7 @@ import static io.trino.plugin.hive.HiveErrorCode.HIVE_INVALID_VIEW_DATA; import static io.trino.plugin.hive.HiveErrorCode.HIVE_VIEW_TRANSLATION_ERROR; import static io.trino.plugin.hive.HiveMetadata.TABLE_COMMENT; -import static io.trino.plugin.hive.HiveSessionProperties.isLegacyHiveViewTranslation; +import static io.trino.plugin.hive.HiveSessionProperties.isHiveViewsLegacyTranslation; import static io.trino.plugin.hive.HiveStorageFormat.TEXTFILE; import static io.trino.plugin.hive.HiveType.toHiveType; import static io.trino.plugin.hive.metastore.StorageFormat.fromHiveStorageFormat; @@ -83,7 +83,7 @@ public static ViewReader createViewReader( if (isPrestoView(table)) { return new PrestoViewReader(); } - if (isLegacyHiveViewTranslation(session)) { + if (isHiveViewsLegacyTranslation(session)) { return new LegacyHiveViewReader(); } diff --git a/plugin/trino-hive/src/test/java/io/trino/plugin/hive/TestHiveConfig.java b/plugin/trino-hive/src/test/java/io/trino/plugin/hive/TestHiveConfig.java index a780ab94dadf..43f131da1a59 100644 --- a/plugin/trino-hive/src/test/java/io/trino/plugin/hive/TestHiveConfig.java +++ b/plugin/trino-hive/src/test/java/io/trino/plugin/hive/TestHiveConfig.java @@ -98,6 +98,7 @@ public void testDefaults() .setFileStatusCacheTables("") .setPerTransactionFileStatusCacheMaximumSize(1000 * 1000) .setTranslateHiveViews(false) + .setLegacyHiveViewTranslation(false) .setHiveTransactionHeartbeatInterval(null) .setHiveTransactionHeartbeatThreads(5) .setAllowRegisterPartition(false) @@ -107,7 +108,6 @@ public void testDefaults() .setDynamicFilteringWaitTimeout(new Duration(0, TimeUnit.MINUTES)) .setTimestampPrecision(HiveTimestampPrecision.DEFAULT_PRECISION) .setOptimizeSymlinkListing(true) - .setLegacyHiveViewTranslation(false) .setIcebergCatalogName(null) .setSizeBasedSplitWeightsEnabled(true) .setMinimumAssignedSplitWeight(0.05)); @@ -178,7 +178,8 @@ public void testExplicitPropertyMappings() .put("hive.file-status-cache-size", "1000") .put("hive.file-status-cache-expire-time", "30m") .put("hive.per-transaction-file-status-cache-maximum-size", "42") - .put("hive.translate-hive-views", "true") + .put("hive.hive-views.enabled", "true") + .put("hive.hive-views.legacy-translation", "true") .put("hive.transaction-heartbeat-interval", "10s") .put("hive.transaction-heartbeat-threads", "10") .put("hive.allow-register-partition-procedure", "true") @@ -188,7 +189,6 @@ public void testExplicitPropertyMappings() .put("hive.dynamic-filtering.wait-timeout", "10s") .put("hive.timestamp-precision", "NANOSECONDS") .put("hive.optimize-symlink-listing", "false") - .put("hive.legacy-hive-view-translation", "true") .put("hive.iceberg-catalog-name", "iceberg") .put("hive.size-based-split-weights-enabled", "false") .put("hive.minimum-assigned-split-weight", "1.0") @@ -257,6 +257,7 @@ public void testExplicitPropertyMappings() .setFileStatusCacheExpireAfterWrite(new Duration(30, TimeUnit.MINUTES)) .setPerTransactionFileStatusCacheMaximumSize(42) .setTranslateHiveViews(true) + .setLegacyHiveViewTranslation(true) .setHiveTransactionHeartbeatInterval(new Duration(10, TimeUnit.SECONDS)) .setHiveTransactionHeartbeatThreads(10) .setAllowRegisterPartition(true) @@ -266,7 +267,6 @@ public void testExplicitPropertyMappings() .setDynamicFilteringWaitTimeout(new Duration(10, TimeUnit.SECONDS)) .setTimestampPrecision(HiveTimestampPrecision.NANOSECONDS) .setOptimizeSymlinkListing(false) - .setLegacyHiveViewTranslation(true) .setIcebergCatalogName("iceberg") .setSizeBasedSplitWeightsEnabled(false) .setMinimumAssignedSplitWeight(1.0); diff --git a/testing/trino-product-tests-launcher/src/main/resources/docker/presto-product-tests/common/hadoop/hive.properties b/testing/trino-product-tests-launcher/src/main/resources/docker/presto-product-tests/common/hadoop/hive.properties index ee491692af43..1d446d901f73 100644 --- a/testing/trino-product-tests-launcher/src/main/resources/docker/presto-product-tests/common/hadoop/hive.properties +++ b/testing/trino-product-tests-launcher/src/main/resources/docker/presto-product-tests/common/hadoop/hive.properties @@ -12,4 +12,4 @@ hive.allow-register-partition-procedure=true hive.metastore-cache-ttl=0s hive.fs.cache.max-size=10 hive.max-partitions-per-scan=100 -hive.translate-hive-views=true +hive.hive-views.enabled=true diff --git a/testing/trino-product-tests-launcher/src/main/resources/docker/presto-product-tests/common/hadoop/hive_timestamp_nanos.properties b/testing/trino-product-tests-launcher/src/main/resources/docker/presto-product-tests/common/hadoop/hive_timestamp_nanos.properties index b1398be12f3d..9ca0bbb8b3df 100644 --- a/testing/trino-product-tests-launcher/src/main/resources/docker/presto-product-tests/common/hadoop/hive_timestamp_nanos.properties +++ b/testing/trino-product-tests-launcher/src/main/resources/docker/presto-product-tests/common/hadoop/hive_timestamp_nanos.properties @@ -3,5 +3,5 @@ hive.metastore.uri=thrift://hadoop-master:9083 hive.config.resources=/docker/presto-product-tests/conf/presto/etc/hive-default-fs-site.xml hive.allow-drop-table=true hive.metastore-cache-ttl=0s -hive.translate-hive-views=true +hive.hive-views.enabled=true hive.timestamp-precision=NANOSECONDS diff --git a/testing/trino-product-tests-launcher/src/main/resources/docker/presto-product-tests/common/hadoop/hive_with_external_writes.properties b/testing/trino-product-tests-launcher/src/main/resources/docker/presto-product-tests/common/hadoop/hive_with_external_writes.properties index f93e331195cb..a0945fd7e4fe 100644 --- a/testing/trino-product-tests-launcher/src/main/resources/docker/presto-product-tests/common/hadoop/hive_with_external_writes.properties +++ b/testing/trino-product-tests-launcher/src/main/resources/docker/presto-product-tests/common/hadoop/hive_with_external_writes.properties @@ -12,5 +12,5 @@ hive.allow-register-partition-procedure=true hive.metastore-cache-ttl=0s hive.fs.cache.max-size=10 hive.max-partitions-per-scan=100 -hive.translate-hive-views=true +hive.hive-views.enabled=true hive.non-managed-table-writes-enabled=true diff --git a/testing/trino-product-tests-launcher/src/main/resources/docker/presto-product-tests/conf/environment/singlenode-hive-iceberg-redirections/hive.properties b/testing/trino-product-tests-launcher/src/main/resources/docker/presto-product-tests/conf/environment/singlenode-hive-iceberg-redirections/hive.properties index c88738fc7f12..8c8bd114f10c 100644 --- a/testing/trino-product-tests-launcher/src/main/resources/docker/presto-product-tests/conf/environment/singlenode-hive-iceberg-redirections/hive.properties +++ b/testing/trino-product-tests-launcher/src/main/resources/docker/presto-product-tests/conf/environment/singlenode-hive-iceberg-redirections/hive.properties @@ -8,4 +8,4 @@ hive.allow-comment-table=true hive.allow-drop-table=true hive.allow-rename-table=true hive.iceberg-catalog-name=iceberg -hive.translate-hive-views=true +hive.hive-views.enabled=true diff --git a/testing/trino-product-tests-launcher/src/main/resources/docker/presto-product-tests/conf/environment/singlenode-kerberos-hdfs-impersonation-with-wire-encryption/hive.properties b/testing/trino-product-tests-launcher/src/main/resources/docker/presto-product-tests/conf/environment/singlenode-kerberos-hdfs-impersonation-with-wire-encryption/hive.properties index 438f44ac4aa2..42eda368ad90 100644 --- a/testing/trino-product-tests-launcher/src/main/resources/docker/presto-product-tests/conf/environment/singlenode-kerberos-hdfs-impersonation-with-wire-encryption/hive.properties +++ b/testing/trino-product-tests-launcher/src/main/resources/docker/presto-product-tests/conf/environment/singlenode-kerberos-hdfs-impersonation-with-wire-encryption/hive.properties @@ -17,6 +17,6 @@ hive.fs.cache.max-size=10 #required for testGrantRevoke() product test hive.security=sql-standard #required for testAccessControlSetHiveViewAuthorization() product test -hive.translate-hive-views=true +hive.hive-views.enabled=true hive.hdfs.wire-encryption.enabled=true diff --git a/testing/trino-product-tests-launcher/src/main/resources/docker/presto-product-tests/conf/environment/singlenode-kerberos-hdfs-impersonation/hive.properties b/testing/trino-product-tests-launcher/src/main/resources/docker/presto-product-tests/conf/environment/singlenode-kerberos-hdfs-impersonation/hive.properties index 8d2032f49233..560e9fa865e2 100644 --- a/testing/trino-product-tests-launcher/src/main/resources/docker/presto-product-tests/conf/environment/singlenode-kerberos-hdfs-impersonation/hive.properties +++ b/testing/trino-product-tests-launcher/src/main/resources/docker/presto-product-tests/conf/environment/singlenode-kerberos-hdfs-impersonation/hive.properties @@ -18,4 +18,4 @@ hive.max-partitions-per-scan=100 #required for testGrantRevoke() product test hive.security=sql-standard #required for testAccessControlSetHiveViewAuthorization() product test -hive.translate-hive-views=true +hive.hive-views.enabled=true diff --git a/testing/trino-product-tests-launcher/src/main/resources/docker/presto-product-tests/conf/environment/singlenode-kerberos-hive-impersonation/hive.properties b/testing/trino-product-tests-launcher/src/main/resources/docker/presto-product-tests/conf/environment/singlenode-kerberos-hive-impersonation/hive.properties index 3688acf16426..e3031def5ec2 100644 --- a/testing/trino-product-tests-launcher/src/main/resources/docker/presto-product-tests/conf/environment/singlenode-kerberos-hive-impersonation/hive.properties +++ b/testing/trino-product-tests-launcher/src/main/resources/docker/presto-product-tests/conf/environment/singlenode-kerberos-hive-impersonation/hive.properties @@ -22,4 +22,4 @@ hive.max-partitions-per-scan=100 #required for testGrantRevoke() product test hive.security=sql-standard #required for testAccessControlSetHiveViewAuthorization() product test -hive.translate-hive-views=true +hive.hive-views.enabled=true diff --git a/testing/trino-product-tests/src/main/java/io/trino/tests/product/hive/TestHiveViewsLegacy.java b/testing/trino-product-tests/src/main/java/io/trino/tests/product/hive/TestHiveViewsLegacy.java index 84d64a4e4a91..88ee87b94ed7 100644 --- a/testing/trino-product-tests/src/main/java/io/trino/tests/product/hive/TestHiveViewsLegacy.java +++ b/testing/trino-product-tests/src/main/java/io/trino/tests/product/hive/TestHiveViewsLegacy.java @@ -39,7 +39,7 @@ public class TestHiveViewsLegacy @BeforeTestWithContext public void setup() { - setSessionProperty("hive.legacy_hive_view_translation", "true"); + setSessionProperty("hive.hive_views_legacy_translation", "true"); } @Override @@ -154,7 +154,7 @@ public void testCurrentUser() protected QueryExecutor connectToTrino(String catalog) { QueryExecutor executor = super.connectToTrino(catalog); - executor.executeQuery("SET SESSION hive.legacy_hive_view_translation = true"); + executor.executeQuery("SET SESSION hive.hive_views_legacy_translation = true"); return executor; } }