final int groupingFields = aggregate.getGroupCount() + aggregate.getIndicatorCount(); Set<String> projectExprsDigest = new HashSet<String>(); Map<String, RexNode> windowingExprsDigestToNodes = new HashMap<String,RexNode>();
final List<AggregateCall> aggCalls = aggRel.getAggCallList(); final List<AggregateCall> newAggCalls = new ArrayList<>(aggCalls.size()); int nextIdx = aggRel.getGroupCount() + aggRel.getIndicatorCount(); for (int i = 0; i < aggCalls.size(); i++) { AggregateCall aggCall = aggCalls.get(i); call.transformTo(newAggregate); } else { final int offset = aggRel.getGroupCount() + aggRel.getIndicatorCount(); final List<RexNode> projList = Lists.newArrayList(); for (int i = 0; i < offset; ++i) {
final int groupingFields = aggregate.getGroupCount() + aggregate.getIndicatorCount(); Set<String> projectExprsDigest = new HashSet<String>(); Map<String, RexNode> windowingExprsDigestToNodes = new HashMap<String,RexNode>();
final int indicatorCount = oldAggRel.getIndicatorCount();
if ((aggregate.getIndicatorCount() > 0) || (aggregate.getGroupSet().isEmpty()) || fieldsUsed.contains(aggregate.getGroupSet())) {
if (aggregate.getGroupSets().size() > 1 || aggregate.getIndicatorCount() > 0 || fieldsUsed.contains(originalGroupSet)) {
+ newAggregate.getIndicatorCount(); i < newAggregate.getRowType().getFieldCount(); i++) { posList.add(i);
aggregate.getGroupCount() + aggregate.getIndicatorCount(); final int newLeftWidth = sides.get(0).newInput.getRowType().getFieldCount(); final List<RexNode> projects =
aggregate.getGroupCount() + aggregate.getIndicatorCount(); final int newLeftWidth = sides.get(0).newInput.getRowType().getFieldCount(); final List<RexNode> projects =
public Set<RelColumnOrigin> getColumnOrigins(Aggregate rel, RelMetadataQuery mq, int iOutputColumn) { if (iOutputColumn < rel.getGroupCount()) { // Group columns pass through directly. return mq.getColumnOrigins(rel.getInput(), iOutputColumn); } if (rel.indicator) { if (iOutputColumn < rel.getGroupCount() + rel.getIndicatorCount()) { // The indicator column is originated here. return ImmutableSet.of(); } } // Aggregate columns are derived from input columns AggregateCall call = rel.getAggCallList().get(iOutputColumn - rel.getGroupCount() - rel.getIndicatorCount()); final Set<RelColumnOrigin> set = new HashSet<>(); for (Integer iInput : call.getArgList()) { Set<RelColumnOrigin> inputSet = mq.getColumnOrigins(rel.getInput(), iInput); inputSet = createDerivedColumnOrigins(inputSet); if (inputSet != null) { set.addAll(inputSet); } } return set; }
public Set<RelColumnOrigin> getColumnOrigins(Aggregate rel, RelMetadataQuery mq, int iOutputColumn) { if (iOutputColumn < rel.getGroupCount()) { // Group columns pass through directly. return mq.getColumnOrigins(rel.getInput(), iOutputColumn); } if (rel.indicator) { if (iOutputColumn < rel.getGroupCount() + rel.getIndicatorCount()) { // The indicator column is originated here. return ImmutableSet.of(); } } // Aggregate columns are derived from input columns AggregateCall call = rel.getAggCallList().get(iOutputColumn - rel.getGroupCount() - rel.getIndicatorCount()); final Set<RelColumnOrigin> set = new HashSet<>(); for (Integer iInput : call.getArgList()) { Set<RelColumnOrigin> inputSet = mq.getColumnOrigins(rel.getInput(), iInput); inputSet = createDerivedColumnOrigins(inputSet); if (inputSet != null) { set.addAll(inputSet); } } return set; }
/** * Returns a list of calls to aggregate functions together with their output * field names. * * @return list of calls to aggregate functions and their output field names */ public List<Pair<AggregateCall, String>> getNamedAggCalls() { final int offset = getGroupCount() + getIndicatorCount(); return Pair.zip(aggCalls, Util.skip(getRowType().getFieldNames(), offset)); }
/** * Returns a list of calls to aggregate functions together with their output * field names. * * @return list of calls to aggregate functions and their output field names */ public List<Pair<AggregateCall, String>> getNamedAggCalls() { final int offset = getGroupCount() + getIndicatorCount(); return Pair.zip(aggCalls, Util.skip(getRowType().getFieldNames(), offset)); }
public int getSourceOpt(int source) { assert aggregate.getIndicatorCount() == 0; if (source < aggregate.getGroupCount()) { int in = tileKey.dimensions.nth(source); return aggregate.getGroupSet().indexOf(in); } Lattice.Measure measure = measures.get(source - aggregate.getGroupCount()); int i = tileKey.measures.indexOf(measure); assert i >= 0; return tileKey.dimensions.cardinality() + i; } } .inverse()));
public int getSourceOpt(int source) { assert aggregate.getIndicatorCount() == 0; if (source < aggregate.getGroupCount()) { int in = tileKey.dimensions.nth(source); return aggregate.getGroupSet().indexOf(in); } Lattice.Measure measure = measures.get(source - aggregate.getGroupCount()); int i = tileKey.measures.indexOf(measure); assert i >= 0; return tileKey.dimensions.cardinality() + i; } } .inverse()));
/** * Takes a bitmap representing a set of input references and extracts the * ones that reference the group by columns in an aggregate. * * @param groupKey the original bitmap * @param aggRel the aggregate * @param childKey sets bits from groupKey corresponding to group by columns */ public static void setAggChildKeys( ImmutableBitSet groupKey, Aggregate aggRel, ImmutableBitSet.Builder childKey) { List<AggregateCall> aggCalls = aggRel.getAggCallList(); for (int bit : groupKey) { if (bit < aggRel.getGroupCount()) { // group by column childKey.set(bit); } else { // aggregate column -- set a bit for each argument being // aggregated AggregateCall agg = aggCalls.get(bit - (aggRel.getGroupCount() + aggRel.getIndicatorCount())); for (Integer arg : agg.getArgList()) { childKey.set(arg); } } } }
/** * Takes a bitmap representing a set of input references and extracts the * ones that reference the group by columns in an aggregate. * * @param groupKey the original bitmap * @param aggRel the aggregate * @param childKey sets bits from groupKey corresponding to group by columns */ public static void setAggChildKeys( ImmutableBitSet groupKey, Aggregate aggRel, ImmutableBitSet.Builder childKey) { List<AggregateCall> aggCalls = aggRel.getAggCallList(); for (int bit : groupKey) { if (bit < aggRel.getGroupCount()) { // group by column childKey.set(bit); } else { // aggregate column -- set a bit for each argument being // aggregated AggregateCall agg = aggCalls.get(bit - (aggRel.getGroupCount() + aggRel.getIndicatorCount())); for (Integer arg : agg.getArgList()) { childKey.set(arg); } } } }
+ newAggregate.getIndicatorCount(); i < newAggregate.getRowType().getFieldCount(); i++) { posList.add(i);
final int indicatorCount = oldAggRel.getIndicatorCount();
final int indicatorCount = oldAggRel.getIndicatorCount();