diff --git a/presto-main/src/main/java/com/facebook/presto/SystemSessionProperties.java b/presto-main/src/main/java/com/facebook/presto/SystemSessionProperties.java index bae8b5dbedcf..99ad3d761687 100644 --- a/presto-main/src/main/java/com/facebook/presto/SystemSessionProperties.java +++ b/presto-main/src/main/java/com/facebook/presto/SystemSessionProperties.java @@ -71,6 +71,7 @@ public final class SystemSessionProperties public static final String ITERATIVE_OPTIMIZER = "iterative_optimizer_enabled"; public static final String ITERATIVE_OPTIMIZER_TIMEOUT = "iterative_optimizer_timeout"; public static final String EXCHANGE_COMPRESSION = "exchange_compression"; + public static final String LEGACY_TIMESTAMP = "legacy_timestamp"; public static final String ENABLE_INTERMEDIATE_AGGREGATIONS = "enable_intermediate_aggregations"; public static final String PUSH_AGGREGATION_THROUGH_JOIN = "push_aggregation_through_join"; public static final String PUSH_PARTIAL_AGGREGATION_THROUGH_JOIN = "push_partial_aggregation_through_join"; @@ -317,6 +318,11 @@ public SystemSessionProperties( "Enable compression in exchanges", featuresConfig.isExchangeCompressionEnabled(), false), + booleanSessionProperty( + LEGACY_TIMESTAMP, + "Use legacy TIME & TIMESTAMP semantics", + featuresConfig.isLegacyTimestamp(), + false), booleanSessionProperty( ENABLE_INTERMEDIATE_AGGREGATIONS, "Enable the use of intermediate aggregations", @@ -512,6 +518,12 @@ public static boolean isNewOptimizerEnabled(Session session) return session.getSystemProperty(ITERATIVE_OPTIMIZER, Boolean.class); } + @Deprecated + public static boolean isLegacyTimestamp(Session session) + { + return session.getSystemProperty(LEGACY_TIMESTAMP, Boolean.class); + } + public static Duration getOptimizerTimeout(Session session) { return session.getSystemProperty(ITERATIVE_OPTIMIZER_TIMEOUT, Duration.class); diff --git a/presto-main/src/main/java/com/facebook/presto/sql/analyzer/FeaturesConfig.java b/presto-main/src/main/java/com/facebook/presto/sql/analyzer/FeaturesConfig.java index 337a8d0a5fd5..8e1a7b839eb8 100644 --- a/presto-main/src/main/java/com/facebook/presto/sql/analyzer/FeaturesConfig.java +++ b/presto-main/src/main/java/com/facebook/presto/sql/analyzer/FeaturesConfig.java @@ -56,6 +56,7 @@ public class FeaturesConfig private boolean exchangeCompressionEnabled; private boolean legacyArrayAgg; private boolean legacyOrderBy; + private boolean legacyTimestamp = true; private boolean legacyMapSubscript; private boolean optimizeMixedDistinctAggregations; private boolean forceSingleNodeOutput = true; @@ -135,6 +136,18 @@ public boolean isLegacyOrderBy() return legacyOrderBy; } + @Config("deprecated.legacy-timestamp") + public FeaturesConfig setLegacyTimestamp(boolean value) + { + this.legacyTimestamp = value; + return this; + } + + public boolean isLegacyTimestamp() + { + return legacyTimestamp; + } + @Config("deprecated.legacy-map-subscript") public FeaturesConfig setLegacyMapSubscript(boolean value) { diff --git a/presto-main/src/test/java/com/facebook/presto/sql/analyzer/TestFeaturesConfig.java b/presto-main/src/test/java/com/facebook/presto/sql/analyzer/TestFeaturesConfig.java index 390cc689800f..07ec1e57baf0 100644 --- a/presto-main/src/test/java/com/facebook/presto/sql/analyzer/TestFeaturesConfig.java +++ b/presto-main/src/test/java/com/facebook/presto/sql/analyzer/TestFeaturesConfig.java @@ -63,6 +63,7 @@ public void testDefaults() .setOptimizeMixedDistinctAggregations(false) .setLegacyOrderBy(false) .setIterativeOptimizerEnabled(true) + .setLegacyTimestamp(true) .setIterativeOptimizerTimeout(new Duration(3, MINUTES)) .setExchangeCompressionEnabled(false) .setEnableIntermediateAggregations(false) @@ -107,6 +108,7 @@ public void testExplicitPropertyMappings() .put("experimental.memory-revoking-threshold", "0.2") .put("experimental.memory-revoking-target", "0.8") .put("exchange.compression-enabled", "true") + .put("deprecated.legacy-timestamp", "false") .put("optimizer.enable-intermediate-aggregations", "true") .put("optimizer.force-single-node-output", "false") .put("pages-index.eager-compaction-enabled", "true") @@ -145,6 +147,7 @@ public void testExplicitPropertyMappings() .setMemoryRevokingTarget(0.8) .setLegacyOrderBy(true) .setExchangeCompressionEnabled(true) + .setLegacyTimestamp(false) .setEnableIntermediateAggregations(true) .setForceSingleNodeOutput(false) .setPagesIndexEagerCompactionEnabled(true)