Skip to content

Commit

Permalink
Extract constant for Delta stats collection config
Browse files Browse the repository at this point in the history
  • Loading branch information
findepi committed Oct 11, 2022
1 parent 9919c35 commit 09edb1a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
@DefunctConfig("delta.experimental.ignore-checkpoint-write-failures")
public class DeltaLakeConfig
{
public static final String EXTENDED_STATISTICS_ENABLED = "delta.extended-statistics.enabled";
public static final String VACUUM_MIN_RETENTION = "delta.vacuum.min-retention";

// Runtime.getRuntime().maxMemory() is not 100% stable and may return slightly different value over JVM lifetime. We use
Expand Down Expand Up @@ -321,7 +322,7 @@ public boolean isExtendedStatisticsEnabled()
return extendedStatisticsEnabled;
}

@Config("delta.extended-statistics.enabled")
@Config(EXTENDED_STATISTICS_ENABLED)
@ConfigDescription("Use extended statistics collected by ANALYZE")
public DeltaLakeConfig setExtendedStatisticsEnabled(boolean extendedStatisticsEnabled)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2234,9 +2234,10 @@ public Optional<TableScanRedirectApplicationResult> applyTableScanRedirect(Conne
public ConnectorAnalyzeMetadata getStatisticsCollectionMetadata(ConnectorSession session, ConnectorTableHandle tableHandle, Map<String, Object> analyzeProperties)
{
if (!isExtendedStatisticsEnabled(session)) {
throw new TrinoException(
NOT_SUPPORTED,
"ANALYZE not supported if extended statistics are disabled. Enable via delta.extended-statistics.enabled config property or extended_statistics_enabled session property.");
throw new TrinoException(NOT_SUPPORTED, format(
"ANALYZE not supported if extended statistics are disabled. Enable via %s config property or %s session property.",
DeltaLakeConfig.EXTENDED_STATISTICS_ENABLED,
DeltaLakeSessionProperties.EXTENDED_STATISTICS_ENABLED));
}

DeltaLakeTableHandle handle = (DeltaLakeTableHandle) tableHandle;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public final class DeltaLakeSessionProperties
private static final String TIMESTAMP_PRECISION = "timestamp_precision";
private static final String DYNAMIC_FILTERING_WAIT_TIMEOUT = "dynamic_filtering_wait_timeout";
private static final String TABLE_STATISTICS_ENABLED = "statistics_enabled";
private static final String EXTENDED_STATISTICS_ENABLED = "extended_statistics_enabled";
public static final String EXTENDED_STATISTICS_ENABLED = "extended_statistics_enabled";

private final List<PropertyMetadata<?>> sessionProperties;

Expand Down

0 comments on commit 09edb1a

Please sign in to comment.