本文整理了Java中org.apache.calcite.rel.core.Aggregate.getInput()
方法的一些代码示例,展示了Aggregate.getInput()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Aggregate.getInput()
方法的具体详情如下:
包路径:org.apache.calcite.rel.core.Aggregate
类名称:Aggregate
方法名:getInput
暂无
代码示例来源:origin: apache/hive
private boolean isAggWithConstantGbyKeys(final Aggregate aggregate, RelOptRuleCall call) {
final RexBuilder rexBuilder = aggregate.getCluster().getRexBuilder();
final RelMetadataQuery mq = call.getMetadataQuery();
final RelOptPredicateList predicates =
mq.getPulledUpPredicates(aggregate.getInput());
if (predicates == null) {
return false;
}
final NavigableMap<Integer, RexNode> map = new TreeMap<>();
for (int key : aggregate.getGroupSet()) {
final RexInputRef ref =
rexBuilder.makeInputRef(aggregate.getInput(), key);
if (predicates.constantMap.containsKey(ref)) {
map.put(key, predicates.constantMap.get(ref));
}
}
// None of the group expressions are constant. Nothing to do.
if (map.isEmpty()) {
return false;
}
final int groupCount = aggregate.getGroupCount();
if (groupCount == map.size()) {
return true;
}
return false;
}
代码示例来源:origin: apache/hive
aggregateCalls.add(aggCall);
return new HiveAggregate(cluster, cluster.traitSetOf(HiveRelNode.CONVENTION),
aggregate.getInput(), groupSet, origGroupSets, aggregateCalls);
代码示例来源:origin: apache/drill
aggregateCalls.add(aggCall);
return new HiveAggregate(cluster, cluster.traitSetOf(HiveRelNode.CONVENTION),
aggregate.getInput(), true, groupSet, origGroupSets, aggregateCalls);
代码示例来源:origin: apache/hive
final List<Pair<RexNode, String>> projects =
new ArrayList<Pair<RexNode, String>>();
final RelNode child = aggregate.getInput();
final List<RelDataTypeField> childFields =
child.getRowType().getFieldList();
代码示例来源:origin: apache/hive
public RelNode align(Aggregate rel, List<RelFieldCollation> collations) {
// 1) We extract the group by positions that are part of the collations and
// sort them so they respect it
LinkedHashSet<Integer> aggregateColumnsOrder = new LinkedHashSet<>();
ImmutableList.Builder<RelFieldCollation> propagateCollations = ImmutableList.builder();
if (rel.getGroupType() == Group.SIMPLE && !collations.isEmpty()) {
for (RelFieldCollation c : collations) {
if (c.getFieldIndex() < rel.getGroupCount()) {
// Group column found
if (aggregateColumnsOrder.add(c.getFieldIndex())) {
propagateCollations.add(c.copy(rel.getGroupSet().nth(c.getFieldIndex())));
}
}
}
}
for (int i = 0; i < rel.getGroupCount(); i++) {
if (!aggregateColumnsOrder.contains(i)) {
// Not included in the input collations, but can be propagated as this Aggregate
// will enforce it
propagateCollations.add(new RelFieldCollation(rel.getGroupSet().nth(i)));
}
}
// 2) We propagate
final RelNode child = dispatchAlign(rel.getInput(), propagateCollations.build());
// 3) We annotate the Aggregate operator with this info
final HiveAggregate newAggregate = (HiveAggregate) rel.copy(rel.getTraitSet(),
ImmutableList.of(child));
newAggregate.setAggregateColumnsOrder(aggregateColumnsOrder);
return newAggregate;
}
代码示例来源:origin: apache/hive
final List<Integer> nullableArgs = new ArrayList<>(args.size());
for (int arg : args) {
if (aggRel.getInput().getRowType().getFieldList().get(arg).getType().isNullable()) {
nullableArgs.add(arg);
final Aggregate newAggregate = aggRel.copy(aggRel.getTraitSet(), aggRel.getInput(),
aggRel.indicator, aggRel.getGroupSet(), aggRel.getGroupSets(),
newAggCalls);
代码示例来源:origin: apache/hive
final RelNode newRight = aggregate.getInput();
final RexNode newCondition =
RelOptUtil.createEquiJoinCondition(left, joinInfo.leftKeys, newRight,
if(aggregate.getInput() instanceof HepRelVertex
&& ((HepRelVertex)aggregate.getInput()).getCurrentRel() instanceof Join) {
Join rightJoin = (Join)(((HepRelVertex)aggregate.getInput()).getCurrentRel());
List<RexNode> projects = new ArrayList<>();
for(int i=0; i<rightJoin.getRowType().getFieldCount(); i++){
semi = call.builder().push(left).push(topProject).semiJoin(newCondition).build();
} else {
semi = call.builder().push(left).push(aggregate.getInput()).semiJoin(newCondition).build();
代码示例来源:origin: apache/hive
relBuilder.push(oldAggRel.getInput());
final List<RexNode> inputExprs = new ArrayList<>(relBuilder.fields());
代码示例来源:origin: apache/hive
private ImmutableBitSet generateGroupSetIfCardinalitySame(final Aggregate aggregate,
final ImmutableBitSet originalGroupSet, final ImmutableBitSet fieldsUsed) {
Pair<RelOptTable, List<Integer>> tabToOrgCol = HiveRelOptUtil.getColumnOriginSet(aggregate.getInput(),
originalGroupSet);
if(tabToOrgCol == null) {
代码示例来源:origin: apache/incubator-druid
aggregate.getInput(),
aggregate.indicator,
aggregate.getGroupSet(),
代码示例来源:origin: apache/hive
final RelNode input = aggregate.getInput();
代码示例来源:origin: apache/drill
public RelNode align(Aggregate rel, List<RelFieldCollation> collations) {
// 1) We extract the group by positions that are part of the collations and
// sort them so they respect it
LinkedHashSet<Integer> aggregateColumnsOrder = new LinkedHashSet<>();
ImmutableList.Builder<RelFieldCollation> propagateCollations = ImmutableList.builder();
if (!rel.indicator && !collations.isEmpty()) {
for (RelFieldCollation c : collations) {
if (c.getFieldIndex() < rel.getGroupCount()) {
// Group column found
if (aggregateColumnsOrder.add(c.getFieldIndex())) {
propagateCollations.add(c.copy(rel.getGroupSet().nth(c.getFieldIndex())));
}
}
}
}
for (int i = 0; i < rel.getGroupCount(); i++) {
if (!aggregateColumnsOrder.contains(i)) {
// Not included in the input collations, but can be propagated as this Aggregate
// will enforce it
propagateCollations.add(new RelFieldCollation(rel.getGroupSet().nth(i)));
}
}
// 2) We propagate
final RelNode child = dispatchAlign(rel.getInput(), propagateCollations.build());
// 3) We annotate the Aggregate operator with this info
final HiveAggregate newAggregate = (HiveAggregate) rel.copy(rel.getTraitSet(),
ImmutableList.of(child));
newAggregate.setAggregateColumnsOrder(aggregateColumnsOrder);
return newAggregate;
}
代码示例来源:origin: apache/hive
final RelNode input = aggregate.getInput();
RelMetadataQuery mq = aggregate.getCluster().getMetadataQuery();
代码示例来源:origin: apache/drill
final RelNode input = agg.getInput();
final RelOptPredicateList inputInfo = mq.getPulledUpPredicates(input);
final List<RexNode> aggPullUpPredicates = new ArrayList<>();
代码示例来源:origin: apache/hive
final RelNode input = agg.getInput();
final RelOptPredicateList inputInfo = mq.getPulledUpPredicates(input);
final List<RexNode> aggPullUpPredicates = new ArrayList<>();
代码示例来源:origin: apache/hive
final int iAvgInput = oldCall.getArgList().get(0);
final RelDataType sum0InputType = typeFactory.createTypeWithNullability(
getFieldType(oldAggRel.getInput(), iAvgInput), true);
final RelDataType sumReturnType = getSumReturnType(
rexBuilder.getTypeFactory(), sum0InputType, oldCall.getType());
oldCall.filterArg,
oldAggRel.getGroupCount(),
oldAggRel.getInput(),
null,
null);
代码示例来源:origin: apache/hive
final int iAvgInput = oldCall.getArgList().get(0);
final RelDataType avgInputType = typeFactory.createTypeWithNullability(
getFieldType(oldAggRel.getInput(), iAvgInput), true);
final RelDataType sumReturnType = getSumReturnType(
rexBuilder.getTypeFactory(), avgInputType, oldCall.getType());
oldCall.filterArg,
oldAggRel.getGroupCount(),
oldAggRel.getInput(),
null,
null);
oldCall.filterArg,
oldAggRel.getGroupCount(),
oldAggRel.getInput(),
countRetType,
null);
代码示例来源:origin: apache/hive
if(shouldTransform) {
final RelBuilder relBuilder = call.builder();
RelNode newRightInput = relBuilder.project(relBuilder.push(rightAggregate.getInput()).
fields(rightAggregate.getGroupSet().asList())).build();
RelNode newSemiJoin = call.builder().push(left).push(newRightInput)
代码示例来源:origin: apache/hive
List<RelDataType> oldArgTypes =
SqlTypeUtil.projectTypes(
oldAggRel.getInput().getRowType(), oldCall.getArgList());
return rexBuilder.addAggCall(oldCall,
nGroups,
代码示例来源:origin: apache/drill
final MutableRel input = toMutable(aggregate.getInput());
return MutableAggregate.of(input, aggregate.indicator,
aggregate.getGroupSet(), aggregate.getGroupSets(),
内容来源于网络,如有侵权,请联系作者删除!