Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions docs/src/main/sphinx/connector/hive.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
</sql/set-session>` to ``true``.

This legacy behavior interprets any HiveQL query that defines a view as if it
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 <hive-views>`. ``false``
``hive.hive-views.enabled`` Enable translation for :ref:`Hive views <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 <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``
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ public class HiveConfig
private long perTransactionFileStatusCacheMaximumSize = 1000 * 1000;

private boolean translateHiveViews;
private boolean legacyHiveViewTranslation;

private Optional<Duration> hiveTransactionHeartbeatInterval = Optional.empty();
private int hiveTransactionHeartbeatThreads = 5;
Expand All @@ -160,7 +161,6 @@ public class HiveConfig

private boolean optimizeSymlinkListing = true;

private boolean legacyHiveViewTranslation;
private Optional<String> icebergCatalogName = Optional.empty();

private DataSize targetMaxFileSize = DataSize.of(1, GIGABYTE);
Expand Down Expand Up @@ -767,15 +767,29 @@ 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)
{
this.translateHiveViews = 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)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why move?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so they are next to each other

{
this.legacyHiveViewTranslation = legacyHiveViewTranslation;
return this;
}

public long getFileStatusCacheMaxSize()
{
return fileStatusCacheMaxSize;
Expand Down Expand Up @@ -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<String> getIcebergCatalogName()
{
return icebergCatalogName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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<String> getIcebergCatalogName(ConnectorSession session)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -83,7 +83,7 @@ public static ViewReader createViewReader(
if (isPrestoView(table)) {
return new PrestoViewReader();
}
if (isLegacyHiveViewTranslation(session)) {
if (isHiveViewsLegacyTranslation(session)) {
return new LegacyHiveViewReader();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ public void testDefaults()
.setFileStatusCacheTables("")
.setPerTransactionFileStatusCacheMaximumSize(1000 * 1000)
.setTranslateHiveViews(false)
.setLegacyHiveViewTranslation(false)
.setHiveTransactionHeartbeatInterval(null)
.setHiveTransactionHeartbeatThreads(5)
.setAllowRegisterPartition(false)
Expand All @@ -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));
Expand Down Expand Up @@ -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")
Expand All @@ -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")
Expand Down Expand Up @@ -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)
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}
}