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 java.lang.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,
java.util.List<ImmutableBitSet> groupSets,
java.util.List<AggregateCall> aggCalls)
Creates a PigAggregate.
|
| Modifier and Type | Method and Description |
|---|---|
Aggregate |
copy(RelTraitSet traitSet,
RelNode input,
boolean indicator,
ImmutableBitSet groupSet,
java.util.List<ImmutableBitSet> groupSets,
java.util.List<AggregateCall> aggCalls) |
private java.util.List<java.lang.String> |
getArgNames(java.lang.String relAlias,
AggregateCall aggCall) |
private java.util.List<java.lang.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 java.lang.String |
getInputFieldName(int fieldIndex) |
private java.lang.String |
getInputFieldNameForAggCall(java.lang.String relAlias,
AggregateCall aggCall,
int fieldIndex) |
private java.lang.String |
getPigAggregateCall(java.lang.String relAlias,
AggregateCall aggCall) |
private java.util.List<java.lang.String> |
getPigAggregateCalls(PigRel.Implementor implementor) |
private java.lang.String |
getPigAggregateStatement(PigRel.Implementor implementor)
Generates a GROUP BY statement, followed by an optional FOREACH statement
for all aggregate functions used.
|
private java.lang.String |
getPigForEachGenerate(PigRel.Implementor implementor)
Generates a FOREACH statement containing invocation of aggregate functions
and projection of grouped fields.
|
private java.lang.String |
getPigGenerateCall(PigRel.Implementor implementor) |
private java.lang.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, isNotGrandTotal, isSimple, isValid, noIndicatorchildrenAccept, 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 java.lang.String DISTINCT_FIELD_SUFFIX
public PigAggregate(RelOptCluster cluster, RelTraitSet traits, RelNode child, boolean indicator, ImmutableBitSet groupSet, java.util.List<ImmutableBitSet> groupSets, java.util.List<AggregateCall> aggCalls)
public Aggregate copy(RelTraitSet traitSet, RelNode input, boolean indicator, ImmutableBitSet groupSet, java.util.List<ImmutableBitSet> groupSets, java.util.List<AggregateCall> aggCalls)
public void implement(PigRel.Implementor implementor)
PigRelprivate java.lang.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 java.lang.String getPigGroupBy(PigRel.Implementor implementor)
A = GROUP A BY (f1, f2);private java.lang.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 java.lang.String getPigGenerateCall(PigRel.Implementor implementor)
private java.util.List<java.lang.String> getPigAggregateCalls(PigRel.Implementor implementor)
private java.lang.String getPigAggregateCall(java.lang.String relAlias,
AggregateCall aggCall)
private PigAggFunction toPigAggFunc(AggregateCall aggCall)
private java.util.List<java.lang.String> getArgNames(java.lang.String relAlias,
AggregateCall aggCall)
private java.lang.String getInputFieldNameForAggCall(java.lang.String relAlias,
AggregateCall aggCall,
int fieldIndex)
private java.util.List<java.lang.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 java.lang.String getInputFieldName(int fieldIndex)
Copyright © 2012–2018 The Apache Software Foundation. All rights reserved.