本文整理了Java中org.apache.calcite.rel.core.Aggregate.copy()
方法的一些代码示例,展示了Aggregate.copy()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Aggregate.copy()
方法的具体详情如下:
包路径:org.apache.calcite.rel.core.Aggregate
类名称:Aggregate
方法名:copy
暂无
代码示例来源:origin: apache/hive
return aggregate.copy(aggregate.getTraitSet(), project, false,
ImmutableBitSet.range(projects.size()),
null, ImmutableList.<AggregateCall>of());
代码示例来源: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
rewriteAggCalls(newAggCalls, argList, sourceOf);
final int cardinality = aggregate.getGroupSet().cardinality();
return aggregate.copy(aggregate.getTraitSet(), distinct,
aggregate.indicator, ImmutableBitSet.range(cardinality), null,
newAggCalls);
代码示例来源:origin: apache/drill
return aggregate.copy(aggregate.getTraitSet(), project, false,
ImmutableBitSet.range(projects.size()),
null, ImmutableList.<AggregateCall>of());
代码示例来源:origin: apache/hive
final Aggregate newAggregate = aggRel.copy(aggRel.getTraitSet(), aggRel.getInput(),
aggRel.indicator, aggRel.getGroupSet(), aggRel.getGroupSets(),
newAggCalls);
代码示例来源:origin: apache/drill
rewriteAggCalls(newAggCalls, argList, sourceOf);
final int cardinality = aggregate.getGroupSet().cardinality();
return aggregate.copy(aggregate.getTraitSet(), distinct,
aggregate.indicator, ImmutableBitSet.range(cardinality), null,
newAggCalls);
代码示例来源:origin: apache/incubator-druid
final Aggregate newAggregate = aggregate.copy(
aggregate.getTraitSet(),
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
aggregate.copy(
aggregate.getTraitSet(), relBuilder.build(),
false, ImmutableBitSet.of(bottomGroupSet), null, bottomAggregateCalls));
aggregate.copy(aggregate.getTraitSet(),
relBuilder.build(), aggregate.indicator,
ImmutableBitSet.of(topGroupSet), null, topAggregateCalls));
代码示例来源:origin: Qihoo360/Quicksql
@Override public final RelNode copy(RelTraitSet traitSet,
List<RelNode> inputs) {
return copy(traitSet, sole(inputs), indicator, groupSet, groupSets,
aggCalls);
}
代码示例来源:origin: org.apache.calcite/calcite-core
@Override public final RelNode copy(RelTraitSet traitSet,
List<RelNode> inputs) {
return copy(traitSet, sole(inputs), indicator, groupSet, groupSets,
aggCalls);
}
代码示例来源:origin: Qihoo360/Quicksql
public void onMatch(RelOptRuleCall call) {
final Aggregate aggregate = call.rel(0);
final DruidQuery query = call.rel(1);
if (!DruidQuery.isValidSignature(query.signature() + 'a')) {
return;
}
if (aggregate.indicator
|| aggregate.getGroupSets().size() != 1
|| BAD_AGG.apply(ImmutableTriple.of(aggregate, (RelNode) aggregate, query))
|| !validAggregate(aggregate, query)) {
return;
}
final RelNode newAggregate = aggregate.copy(aggregate.getTraitSet(),
ImmutableList.of(Util.last(query.rels)));
call.transformTo(DruidQuery.extendQuery(query, newAggregate));
}
代码示例来源:origin: org.apache.calcite/calcite-core
final int cardinality = aggregate.getGroupSet().cardinality();
relBuilder.push(
aggregate.copy(aggregate.getTraitSet(), relBuilder.build(),
aggregate.indicator, ImmutableBitSet.range(cardinality), null,
newAggCalls));
代码示例来源:origin: qubole/quark
return aggregate1.copy(aggregate1.getTraitSet(), aggregate2.getInput(),
aggregate1.indicator, newGroupSets, ImmutableList.of(newGroupSets), newAggCalls);
} else {
代码示例来源:origin: com.alibaba.blink/flink-table
ImmutableBitSet newGroupSet = ImmutableBitSet.of(fullGroupSet);
List<AggregateCall> aggCalls = JavaConverters.seqAsJavaListConverter(regularAggCalls).asJava();
final Aggregate newAgg = aggregate.copy(
aggregate.getTraitSet(),
aggregate.getInput(),
代码示例来源:origin: Qihoo360/Quicksql
final int cardinality = aggregate.getGroupSet().cardinality();
relBuilder.push(
aggregate.copy(aggregate.getTraitSet(), relBuilder.build(),
aggregate.indicator, ImmutableBitSet.range(cardinality), null,
newAggCalls));
代码示例来源:origin: com.facebook.presto.hive/hive-apache
rewriteAggCalls(newAggCalls, argList, sourceOf);
final int cardinality = aggregate.getGroupSet().cardinality();
return aggregate.copy(aggregate.getTraitSet(), distinct,
aggregate.indicator, ImmutableBitSet.range(cardinality), null,
newAggCalls);
代码示例来源:origin: com.alibaba.blink/flink-table
final int cardinality = aggregate.getGroupSet().cardinality();
relBuilder.push(
aggregate.copy(aggregate.getTraitSet(), relBuilder.build(),
aggregate.indicator, ImmutableBitSet.range(cardinality), null,
newAggCalls));
代码示例来源:origin: Qihoo360/Quicksql
return;
rel = aggRel.copy(aggRel.getTraitSet(), ImmutableList.of(rel));
rel = builder.push(rel).filter(remainingConditions).build();
call.transformTo(rel);
代码示例来源:origin: org.apache.calcite/calcite-druid
public void onMatch(RelOptRuleCall call) {
final Aggregate aggregate = call.rel(0);
final DruidQuery query = call.rel(1);
final RelNode topDruidNode = query.getTopNode();
final Project project = topDruidNode instanceof Project ? (Project) topDruidNode : null;
if (!DruidQuery.isValidSignature(query.signature() + 'a')) {
return;
}
if (aggregate.indicator
|| aggregate.getGroupSets().size() != 1) {
return;
}
if (DruidQuery
.computeProjectGroupSet(project, aggregate.getGroupSet(), query.table.getRowType(), query)
== null) {
return;
}
final List<String> aggNames = Util
.skip(aggregate.getRowType().getFieldNames(), aggregate.getGroupSet().cardinality());
if (DruidQuery.computeDruidJsonAgg(aggregate.getAggCallList(), aggNames, project, query)
== null) {
return;
}
final RelNode newAggregate = aggregate
.copy(aggregate.getTraitSet(), ImmutableList.of(query.getTopNode()));
call.transformTo(DruidQuery.extendQuery(query, newAggregate));
}
}
内容来源于网络,如有侵权,请联系作者删除!