Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@
import static com.facebook.presto.geospatial.type.BingTileType.BING_TILE;
import static com.facebook.presto.geospatial.type.GeometryType.GEOMETRY;
import static com.facebook.presto.metadata.SignatureBinder.applyBoundVariables;
import static com.facebook.presto.operator.aggregation.AlternativeArbitraryAggregationFunction.ALTERNATIVE_ANY_VALUE_AGGREGATION;
import static com.facebook.presto.operator.aggregation.AlternativeArbitraryAggregationFunction.ALTERNATIVE_ARBITRARY_AGGREGATION;
import static com.facebook.presto.operator.aggregation.AlternativeMaxAggregationFunction.ALTERNATIVE_MAX;
import static com.facebook.presto.operator.aggregation.AlternativeMinAggregationFunction.ALTERNATIVE_MIN;
Expand Down Expand Up @@ -992,6 +993,7 @@ private List<? extends SqlFunction> getBuildInFunctions(FeaturesConfig featuresC
// Replace some aggregations for Velox to override intermediate aggregation type.
if (featuresConfig.isUseAlternativeFunctionSignatures()) {
builder.override(ARBITRARY_AGGREGATION, ALTERNATIVE_ARBITRARY_AGGREGATION);
builder.override(ANY_VALUE_AGGREGATION, ALTERNATIVE_ANY_VALUE_AGGREGATION);
builder.override(MAX_AGGREGATION, ALTERNATIVE_MAX);
builder.override(MIN_AGGREGATION, ALTERNATIVE_MIN);
builder.override(MAX_BY, ALTERNATIVE_MAX_BY);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,18 @@ public class AlternativeArbitraryAggregationFunction
{
public static final AlternativeArbitraryAggregationFunction ALTERNATIVE_ARBITRARY_AGGREGATION = new AlternativeArbitraryAggregationFunction();

public static final AlternativeArbitraryAggregationFunction ALTERNATIVE_ANY_VALUE_AGGREGATION = new AlternativeArbitraryAggregationFunction(ArbitraryAggregationFunction.getAnyValueName());

public AlternativeArbitraryAggregationFunction()
{
super();
}

public AlternativeArbitraryAggregationFunction(String name)
{
super(name);
}

@Override
protected Type overrideIntermediateType(Type inputType, Type defaultIntermediateType)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ protected ArbitraryAggregationFunction(String name)
ImmutableList.of(parseTypeSignature("T")));
}

protected static String getAnyValueName()
{
return ANY_VALUE_NAME;
}

@Override
public String getDescription()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -337,11 +337,11 @@ public void testChecksum()
public void testArbitrary()
{
// Non-deterministic queries
assertQuerySucceeds("SELECT orderkey, arbitrary(comment) FROM lineitem GROUP BY 1");
assertQuerySucceeds("SELECT orderkey, any_value(comment) FROM lineitem GROUP BY 1");
assertQuerySucceeds("SELECT orderkey, arbitrary(discount) FROM lineitem GROUP BY 1");
assertQuerySucceeds("SELECT orderkey, arbitrary(linenumber) FROM lineitem GROUP BY 1");
assertQuerySucceeds("SELECT orderkey, any_value(linenumber) FROM lineitem GROUP BY 1");
assertQuerySucceeds("SELECT orderkey, arbitrary(linenumber_as_smallint) FROM lineitem GROUP BY 1");
assertQuerySucceeds("SELECT orderkey, arbitrary(linenumber_as_tinyint) FROM lineitem GROUP BY 1");
assertQuerySucceeds("SELECT orderkey, any_value(linenumber_as_tinyint) FROM lineitem GROUP BY 1");
assertQuerySucceeds("SELECT orderkey, arbitrary(tax_as_real) FROM lineitem GROUP BY 1");
}

Expand Down