Skip to content

Commit

Permalink
Link FunctionInfo to provider
Browse files Browse the repository at this point in the history
  • Loading branch information
martint committed Oct 18, 2012
1 parent a38a9e6 commit 62196b1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
15 changes: 13 additions & 2 deletions src/main/java/com/facebook/presto/metadata/FunctionInfo.java
Original file line number Diff line number Diff line change
@@ -1,16 +1,27 @@
package com.facebook.presto.metadata;

import com.facebook.presto.aggregation.AggregationFunction;

import javax.inject.Provider;

public class FunctionInfo
{
private boolean isAggregate;
private final boolean isAggregate;
private final Provider<AggregationFunction> provider;

public FunctionInfo(boolean aggregate)
public FunctionInfo(boolean aggregate, Provider<AggregationFunction> provider)
{
isAggregate = aggregate;
this.provider = provider;
}

public boolean isAggregate()
{
return isAggregate;
}

public Provider<AggregationFunction> getProvider()
{
return provider;
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package com.facebook.presto.sql.compiler;

import com.facebook.presto.TupleInfo;
import com.facebook.presto.aggregation.AverageAggregation;
import com.facebook.presto.aggregation.CountAggregation;
import com.facebook.presto.aggregation.SumAggregation;
import com.facebook.presto.metadata.ColumnMetadata;
import com.facebook.presto.metadata.FunctionInfo;
import com.facebook.presto.metadata.Metadata;
Expand Down Expand Up @@ -46,11 +49,9 @@ public void setUp()
.build();

Map<String, FunctionInfo> functions = ImmutableMap.<String, FunctionInfo>builder()
.put("COUNT", new FunctionInfo(true))
.put("SUM", new FunctionInfo(true))
.put("AVG", new FunctionInfo(true))
.put("MAX", new FunctionInfo(true))
.put("MIN", new FunctionInfo(true))
.put("COUNT", new FunctionInfo(true, CountAggregation.PROVIDER))
.put("SUM", new FunctionInfo(true, SumAggregation.PROVIDER))
.put("AVG", new FunctionInfo(true, AverageAggregation.PROVIDER))
.build();

metadata = new Metadata(tables, functions);
Expand Down

0 comments on commit 62196b1

Please sign in to comment.