Skip to content
This repository has been archived by the owner on Dec 9, 2022. It is now read-only.

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 Nov 23, 2017
1 parent 0304333 commit 5a7b781
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 @@ -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";
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public void testDefaults()
.setIterativeOptimizerEnabled(true)
.setIterativeOptimizerTimeout(new Duration(3, MINUTES))
.setExchangeCompressionEnabled(false)
.setLegacyTimestamp(true)
.setEnableIntermediateAggregations(false)
.setPushAggregationThroughJoin(true)
.setForceSingleNodeOutput(true)
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -145,6 +147,7 @@ public void testExplicitPropertyMappings()
.setMemoryRevokingTarget(0.8)
.setLegacyOrderBy(true)
.setExchangeCompressionEnabled(true)
.setLegacyTimestamp(false)
.setEnableIntermediateAggregations(true)
.setForceSingleNodeOutput(false)
.setPagesIndexEagerCompactionEnabled(true)
Expand Down

0 comments on commit 5a7b781

Please sign in to comment.