public class PigAggregate extends Aggregate implements PigRel
Aggregate in
Pig calling convention.Aggregate.AggCallBinding, Aggregate.GroupPigRel.ImplementorRelNode.Context| Modifier and Type | Field and Description |
|---|---|
static String |
DISTINCT_FIELD_SUFFIX |
aggCalls, groupSet, groupSets, indicator, IS_NOT_GRAND_TOTAL, IS_SIMPLE, NO_INDICATORdigest, id, rowType, traitSetCONVENTION| Constructor and Description |
|---|
PigAggregate(RelOptCluster cluster,
RelTraitSet traits,
RelNode child,
boolean indicator,
ImmutableBitSet groupSet,
List<ImmutableBitSet> groupSets,
List<AggregateCall> aggCalls)
Creates a PigAggregate.
|
| Modifier and Type | Method and Description |
|---|---|
Aggregate |
copy(RelTraitSet traitSet,
RelNode input,
boolean indicator,
ImmutableBitSet groupSet,
List<ImmutableBitSet> groupSets,
List<AggregateCall> aggCalls) |
private List<String> |
getArgNames(String relAlias,
AggregateCall aggCall) |
private List<String> |
getDistinctCalls(PigRel.Implementor implementor)
A agg function call like
COUNT(DISTINCT COL) in Pig is
achieved via two statements in a FOREACH that follows a GROUP statement:
TABLE = GROUP TABLE ALL;
|
private String |
getInputFieldName(int fieldIndex) |
private String |
getInputFieldNameForAggCall(String relAlias,
AggregateCall aggCall,
int fieldIndex) |
private String |
getPigAggregateCall(String relAlias,
AggregateCall aggCall) |
private List<String> |
getPigAggregateCalls(PigRel.Implementor implementor) |
private String |
getPigAggregateStatement(PigRel.Implementor implementor)
Generates a GROUP BY statement, followed by an optional FOREACH statement
for all aggregate functions used.
|
private String |
getPigForEachGenerate(PigRel.Implementor implementor)
Generates a FOREACH statement containing invocation of aggregate functions
and projection of grouped fields.
|
private String |
getPigGenerateCall(PigRel.Implementor implementor) |
private String |
getPigGroupBy(PigRel.Implementor implementor)
Generates the GROUP BY statement, e.g.
|
RelOptTable |
getTable()
Override this method so it looks down the tree to find the table this node
is acting on.
|
void |
implement(PigRel.Implementor implementor)
Converts this node to a Pig Latin statement.
|
private PigAggFunction |
toPigAggFunc(AggregateCall aggCall) |
computeSelfCost, containsDistinctCall, copy, deriveRowType, deriveRowType, estimateRowCount, explainTerms, getAggCallList, getGroupCount, getGroupSet, getGroupSets, getGroupType, getIndicatorCount, getNamedAggCalls, isValidchildrenAccept, getInput, getInputs, replaceInputaccept, accept, collectVariablesSet, collectVariablesUsed, computeDigest, computeSelfCost, explain, getChildExps, getCluster, getCollationList, getConvention, getCorrelVariable, getDescription, getDigest, getExpectedInputRowType, getId, getInput, getQuery, getRelTypeName, getRows, getRowType, getTraitSet, getVariablesSet, getVariablesStopped, isDistinct, isKey, isValid, metadata, onRegister, recomputeDigest, register, sole, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaccept, accept, childrenAccept, collectVariablesSet, collectVariablesUsed, computeSelfCost, computeSelfCost, copy, estimateRowCount, explain, getChildExps, getCollationList, getConvention, getCorrelVariable, getExpectedInputRowType, getInput, getInputs, getQuery, getRelTypeName, getRows, getRowType, getVariablesSet, getVariablesStopped, isDistinct, isKey, isValid, isValid, metadata, onRegister, recomputeDigest, register, replaceInputgetCluster, getDescription, getDigest, getId, getTraitSetpublic static final String DISTINCT_FIELD_SUFFIX
public PigAggregate(RelOptCluster cluster, RelTraitSet traits, RelNode child, boolean indicator, ImmutableBitSet groupSet, List<ImmutableBitSet> groupSets, List<AggregateCall> aggCalls)
public Aggregate copy(RelTraitSet traitSet, RelNode input, boolean indicator, ImmutableBitSet groupSet, List<ImmutableBitSet> groupSets, List<AggregateCall> aggCalls)
public void implement(PigRel.Implementor implementor)
PigRelprivate String getPigAggregateStatement(PigRel.Implementor implementor)
A = GROUP A BY owner;
A = FOREACH A GENERATE group, SUM(A.pet_num);
public RelOptTable getTable()
getTable in interface RelNodegetTable in class AbstractRelNodeprivate String getPigGroupBy(PigRel.Implementor implementor)
A = GROUP A BY (f1, f2);private String getPigForEachGenerate(PigRel.Implementor implementor)
A = FOREACH A GENERATE group, SUM(A.pet_num);documentation for special meaning of the "group" field after GROUP
BY.private String getPigGenerateCall(PigRel.Implementor implementor)
private List<String> getPigAggregateCalls(PigRel.Implementor implementor)
private String getPigAggregateCall(String relAlias, AggregateCall aggCall)
private PigAggFunction toPigAggFunc(AggregateCall aggCall)
private List<String> getArgNames(String relAlias, AggregateCall aggCall)
private String getInputFieldNameForAggCall(String relAlias, AggregateCall aggCall, int fieldIndex)
private List<String> getDistinctCalls(PigRel.Implementor implementor)
COUNT(DISTINCT COL) in Pig is
achieved via two statements in a FOREACH that follows a GROUP statement:
TABLE = GROUP TABLE ALL;
TABLE = FOREACH TABLE {
COL.DISTINCT = DISTINCT COL;
GENERATE COUNT(COL.DISTINCT) AS C;
}
private String getInputFieldName(int fieldIndex)
Copyright © 2012–2017 The Apache Software Foundation. All rights reserved.