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 70e52d7c5a1c..d6fe86fbb0a5 100644 --- a/presto-main/src/main/java/com/facebook/presto/SystemSessionProperties.java +++ b/presto-main/src/main/java/com/facebook/presto/SystemSessionProperties.java @@ -69,6 +69,7 @@ public final class SystemSessionProperties public static final String REORDER_WINDOWS = "reorder_windows"; public static final String ITERATIVE_OPTIMIZER = "iterative_optimizer_enabled"; public static final String EXCHANGE_COMPRESSION = "exchange_compression"; + public static final String LEGACY_TIMESTAMP = "legacy_timestamp"; private final List> sessionProperties; @@ -283,6 +284,11 @@ public SystemSessionProperties( EXCHANGE_COMPRESSION, "Enable compression in exchanges", featuresConfig.isExchangeCompressionEnabled(), + false), + booleanSessionProperty( + LEGACY_TIMESTAMP, + "Use legacy TIMESTAMP, TIME & DATE semantic", + featuresConfig.isLegacyTimestamp(), false)); } @@ -445,6 +451,11 @@ 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 boolean isExchangeCompressionEnabled(Session session) { return session.getSystemProperty(EXCHANGE_COMPRESSION, Boolean.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 b3a3b93c4987..4f59ea9773e8 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 static class ProcessingOptimization private boolean exchangeCompressionEnabled = false; private boolean legacyArrayAgg; private boolean legacyOrderBy; + private boolean legacyTimestamp = true; private boolean legacyMapSubscript; private boolean optimizeMixedDistinctAggregations; @@ -125,6 +126,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 43ec0b226b6e..e913ece3f66d 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 @@ -60,7 +60,8 @@ public void testDefaults() .setOptimizeMixedDistinctAggregations(false) .setLegacyOrderBy(false) .setIterativeOptimizerEnabled(false) - .setExchangeCompressionEnabled(false)); + .setExchangeCompressionEnabled(false) + .setLegacyTimestamp(true)); } @Test @@ -93,6 +94,7 @@ public void testExplicitPropertyMappings() .put("experimental.spiller-spill-path", "/tmp/custom/spill/path") .put("experimental.spiller-threads", "42") .put("exchange.compression-enabled", "true") + .put("deprecated.legacy-timestamp", "false") .build(); Map properties = new ImmutableMap.Builder() .put("experimental.resource-groups-enabled", "true") @@ -121,6 +123,7 @@ public void testExplicitPropertyMappings() .put("experimental.spiller-spill-path", "/tmp/custom/spill/path") .put("experimental.spiller-threads", "42") .put("exchange.compression-enabled", "true") + .put("deprecated.legacy-timestamp", "false") .build(); FeaturesConfig expected = new FeaturesConfig() @@ -149,7 +152,8 @@ public void testExplicitPropertyMappings() .setSpillerSpillPath("/tmp/custom/spill/path") .setSpillerThreads(42) .setLegacyOrderBy(true) - .setExchangeCompressionEnabled(true); + .setExchangeCompressionEnabled(true) + .setLegacyTimestamp(false); assertFullMapping(properties, expected); assertDeprecatedEquivalence(FeaturesConfig.class, properties, propertiesLegacy);