Skip to content

Commit

Permalink
Add config and session property deprecated.legacy-timestamp
Browse files Browse the repository at this point in the history
This is flag for switching between legacy TIME/TIMESTAMP semantic
and new one being aligned with ANSI SQL. See: prestodb#7122
  • Loading branch information
fiedukow authored and losipiuk committed Dec 22, 2017
1 parent d5d2c11 commit 0f19195
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,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";
Expand Down Expand Up @@ -341,6 +342,11 @@ public SystemSessionProperties(
"Enable compression in exchanges",
featuresConfig.isExchangeCompressionEnabled(),
false),
booleanSessionProperty(
LEGACY_TIMESTAMP,
"Use legacy TIME & TIMESTAMP semantics",
featuresConfig.isLegacyTimestamp(),
true),
booleanSessionProperty(
ENABLE_INTERMEDIATE_AGGREGATIONS,
"Enable the use of intermediate aggregations",
Expand Down Expand Up @@ -563,6 +569,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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,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;
Expand Down Expand Up @@ -139,6 +140,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)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public void testDefaults()
.setIterativeOptimizerEnabled(true)
.setIterativeOptimizerTimeout(new Duration(3, MINUTES))
.setExchangeCompressionEnabled(false)
.setLegacyTimestamp(true)
.setEnableIntermediateAggregations(false)
.setPushAggregationThroughJoin(true)
.setParseDecimalLiteralsAsDouble(true)
Expand Down Expand Up @@ -113,6 +114,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("parse-decimal-literals-as-double", "false")
.put("optimizer.force-single-node-output", "false")
Expand Down Expand Up @@ -154,6 +156,7 @@ public void testExplicitPropertyMappings()
.setMemoryRevokingTarget(0.8)
.setLegacyOrderBy(true)
.setExchangeCompressionEnabled(true)
.setLegacyTimestamp(false)
.setEnableIntermediateAggregations(true)
.setParseDecimalLiteralsAsDouble(false)
.setForceSingleNodeOutput(false)
Expand Down

0 comments on commit 0f19195

Please sign in to comment.