Skip to content

Commit

Permalink
Add property for new nan behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
rschlussel committed Jun 6, 2024
1 parent d19a962 commit 8f122fc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,8 @@ public class FeaturesConfig
private CreateView.Security defaultViewSecurityMode = DEFINER;
private boolean useHistograms;

private boolean useNewNanDefinition;

public enum PartitioningPrecisionStrategy
{
// Let Presto decide when to repartition
Expand Down Expand Up @@ -3117,4 +3119,17 @@ public FeaturesConfig setUseHistograms(boolean useHistograms)
this.useHistograms = useHistograms;
return this;
}

public boolean getUseNewNanDefinition()
{
return useNewNanDefinition;
}

@Config("use-new-nan-definition")
@ConfigDescription("Enable functions to use the new consistent NaN definition where NaN=NaN and is sorted largest")
public FeaturesConfig setUseNewNanDefinition(boolean useNewNanDefinition)
{
this.useNewNanDefinition = useNewNanDefinition;
return this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ public void testDefaults()
.setLegacyJsonCast(true)
.setPrintEstimatedStatsFromCache(false)
.setUseHistograms(false));
.setUseNewNanDefinition(false));
}

@Test
Expand Down Expand Up @@ -487,6 +488,7 @@ public void testExplicitPropertyMappings()
.put("cte-heuristic-replication-threshold", "2")
.put("optimizer.print-estimated-stats-from-cache", "true")
.put("optimizer.use-histograms", "true")
.put("use-new-nan-definition", "true")
.build();

FeaturesConfig expected = new FeaturesConfig()
Expand Down Expand Up @@ -699,7 +701,8 @@ public void testExplicitPropertyMappings()
.setCteHeuristicReplicationThreshold(2)
.setLegacyJsonCast(false)
.setPrintEstimatedStatsFromCache(true)
.setUseHistograms(true);
.setUseHistograms(true)
.setUseNewNanDefinition(true);
assertFullMapping(properties, expected);
}

Expand Down

0 comments on commit 8f122fc

Please sign in to comment.