org.apache.calcite.rel.core.Aggregate.getAggCallList()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(7.4k)|赞(0)|评价(0)|浏览(129)

本文整理了Java中org.apache.calcite.rel.core.Aggregate.getAggCallList()方法的一些代码示例,展示了Aggregate.getAggCallList()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Aggregate.getAggCallList()方法的具体详情如下:
包路径:org.apache.calcite.rel.core.Aggregate
类名称:Aggregate
方法名:getAggCallList

Aggregate.getAggCallList介绍

[英]Returns a list of calls to aggregate functions.
[中]

代码示例

代码示例来源:origin: apache/hive

private static boolean isEmptyGrpAggr(RelNode gbNode) {
 // Verify if both groupset and aggrfunction are empty)
 Aggregate aggrnode = (Aggregate) gbNode;
 if (aggrnode.getGroupSet().isEmpty() && aggrnode.getAggCallList().isEmpty()) {
  return true;
 }
 return false;
}

代码示例来源:origin: apache/hive

private SqlTypeName getAggTypeForScalarSub(RexSubQuery e) {
 assert(e.getKind() == SqlKind.SCALAR_QUERY);
 assert(e.rel.getInputs().size() == 1);
 Aggregate relAgg = (Aggregate)e.rel.getInput(0);
 assert(relAgg.getAggCallList().size() == 1); //should only have one aggregate
 return relAgg.getAggCallList().get(0).getType().getSqlTypeName();
}

代码示例来源:origin: apache/hive

private boolean isAggZeroOnEmpty(RexSubQuery e) {
 //as this is corr scalar subquery with agg we expect one aggregate
 assert(e.getKind() == SqlKind.SCALAR_QUERY);
 assert(e.rel.getInputs().size() == 1);
 Aggregate relAgg = (Aggregate)e.rel.getInput(0);
 assert(relAgg.getAggCallList().size() == 1); //should only have one aggregate
 if(relAgg.getAggCallList().get(0).getAggregation().getKind() == SqlKind.COUNT) {
  return true;
 }
 return false;
}

代码示例来源:origin: apache/drill

private static boolean isEmptyGrpAggr(RelNode gbNode) {
 // Verify if both groupset and aggrfunction are empty)
 Aggregate aggrnode = (Aggregate) gbNode;
 if (aggrnode.getGroupSet().isEmpty() && aggrnode.getAggCallList().isEmpty()) {
  return true;
 }
 return false;
}

代码示例来源:origin: apache/hive

@Override public boolean matches(RelOptRuleCall call) {
 if (!super.matches(call)) {
  return false;
 }
 Aggregate oldAggRel = (Aggregate) call.rels[0];
 return containsAvgStddevVarCall(oldAggRel.getAggCallList());
}

代码示例来源:origin: apache/drill

private SqlTypeName getAggTypeForScalarSub(RexSubQuery e) {
  assert(e.getKind() == SqlKind.SCALAR_QUERY);
  assert(e.rel.getInputs().size() == 1);
  Aggregate relAgg = (Aggregate)e.rel.getInput(0);
  assert( relAgg.getAggCallList().size() == 1); //should only have one aggregate
  return relAgg.getAggCallList().get(0).getType().getSqlTypeName();
}

代码示例来源:origin: apache/drill

private boolean isAggZeroOnEmpty(RexSubQuery e) {
  //as this is corr scalar subquery with agg we expect one aggregate
  assert(e.getKind() == SqlKind.SCALAR_QUERY);
  assert(e.rel.getInputs().size() == 1);
  Aggregate relAgg = (Aggregate)e.rel.getInput(0);
  assert( relAgg.getAggCallList().size() == 1); //should only have one aggregate
  if( relAgg.getAggCallList().get(0).getAggregation().getKind() == SqlKind.COUNT ) {
    return true;
  }
  return false;
}
private SqlTypeName getAggTypeForScalarSub(RexSubQuery e) {

代码示例来源:origin: apache/hive

/**
 * Returns the number of count DISTINCT
 *
 * @return the number of count DISTINCT
 */
private int getNumCountDistinctCall(Aggregate hiveAggregate) {
 int cnt = 0;
 for (AggregateCall aggCall : hiveAggregate.getAggCallList()) {
  if (aggCall.isDistinct() && (aggCall.getAggregation().getName().equalsIgnoreCase("count"))) {
   cnt++;
  }
 }
 return cnt;
}

代码示例来源:origin: apache/incubator-druid

final String outputNamePrefix = Calcites.findUnusedPrefix("a", new TreeSet<>(sourceRowSignature.getRowOrder()));
for (int i = 0; i < aggregate.getAggCallList().size(); i++) {
 final String aggName = outputNamePrefix + i;
 final AggregateCall aggCall = aggregate.getAggCallList().get(i);
 final Aggregation aggregation = GroupByRules.translateAggregateCall(
   plannerContext,

代码示例来源:origin: apache/drill

/**
 * Returns the number of count DISTINCT
 *
 * @return the number of count DISTINCT
 */
private int getNumCountDistinctCall(Aggregate hiveAggregate) {
 int cnt = 0;
 for (AggregateCall aggCall : hiveAggregate.getAggCallList()) {
  if (aggCall.isDistinct() && (aggCall.getAggregation().getName().equalsIgnoreCase("count"))) {
   cnt++;
  }
 }
 return cnt;
}

代码示例来源:origin: apache/incubator-druid

@Override
public boolean matches(final RelOptRuleCall call)
{
 final Aggregate aggregate = call.rel(0);
 final Project project = call.rel(1);
 if (aggregate.indicator || aggregate.getGroupSets().size() != 1) {
  return false;
 }
 for (AggregateCall aggregateCall : aggregate.getAggCallList()) {
  if (isOneArgAggregateCall(aggregateCall)
    && isThreeArgCase(project.getChildExps().get(Iterables.getOnlyElement(aggregateCall.getArgList())))) {
   return true;
  }
 }
 return false;
}

代码示例来源:origin: apache/hive

@Override
public boolean matches(RelOptRuleCall call) {
 final Aggregate aggregate = call.rel(0);
 // Rule cannot be applied if there are GroupingId because it will change the
 // value as the position will be changed.
 for (AggregateCall aggCall : aggregate.getAggCallList()) {
  if (aggCall.getAggregation().equals(HiveGroupingID.INSTANCE)) {
   return false;
  }
 }
 return super.matches(call);
}

代码示例来源:origin: apache/drill

@Override
public boolean matches(RelOptRuleCall call) {
 final Aggregate aggregate = call.rel(0);
 // Rule cannot be applied if there are GroupingId because it will change the
 // value as the position will be changed.
 for (AggregateCall aggCall : aggregate.getAggCallList()) {
  if (aggCall.getAggregation().equals(HiveGroupingID.INSTANCE)) {
   return false;
  }
 }
 return super.matches(call);
}

代码示例来源:origin: apache/hive

|| (singleAggregate.getAggCallList().size() != 1)
   || !(singleAggregate.getAggCallList().get(0).getAggregation()
   instanceof SqlSingleValueAggFunction)) {
return;

代码示例来源:origin: apache/hive

Lists.newArrayList(aggregate.getAggCallList());
rewriteAggCalls(newAggCalls, argList, sourceOf);
final int cardinality = aggregate.getGroupSet().cardinality();

代码示例来源:origin: apache/incubator-druid

final int fieldCount = aggregate.getGroupCount() + aggregate.getAggCallList().size();
if (fieldCount != aggregate.getRowType().getFieldCount()) {
 throw new ISE(
);
if (callsToKeep.cardinality() < aggregate.getAggCallList().size()) {
  newAggregateCalls.add(aggregate.getAggCallList().get(i - aggregate.getGroupCount()));

代码示例来源:origin: apache/incubator-druid

cost *= COST_GROUPING_MULTIPLIER;
cost += COST_PER_COLUMN * partialQuery.getAggregate().getGroupSet().size();
cost += COST_PER_COLUMN * partialQuery.getAggregate().getAggCallList().size();

代码示例来源:origin: apache/hive

@Override public void onMatch(RelOptRuleCall call) {
  final Aggregate topAggregate = call.rel(0);
  final Join join = call.rel(1);
  final RelNode left = call.rel(2);
  final Aggregate aggregate = call.rel(3);
  // Gather columns used by aggregate operator
  final ImmutableBitSet.Builder topRefs = ImmutableBitSet.builder();
  topRefs.addAll(topAggregate.getGroupSet());
  for (AggregateCall aggCall : topAggregate.getAggCallList()) {
   topRefs.addAll(aggCall.getArgList());
   if (aggCall.filterArg != -1) {
    topRefs.set(aggCall.filterArg);
   }
  }
  perform(call, topRefs.build(), topAggregate, join, left, aggregate);
 }
}

代码示例来源:origin: apache/hive

if(!rightAggregate.getAggCallList().isEmpty()) {
 return;

代码示例来源:origin: apache/hive

Schema(Schema src, Aggregate gBy) {
 for (int i : gBy.getGroupSet()) {
  ColumnInfo cI = src.get(i);
  add(cI);
 }
 List<AggregateCall> aggs = gBy.getAggCallList();
 for (AggregateCall agg : aggs) {
  if (agg.getAggregation() == HiveGroupingID.INSTANCE) {
   add(new ColumnInfo(null,VirtualColumn.GROUPINGID.getName()));
   continue;
  }
  int argCount = agg.getArgList().size();
  ASTBuilder b = agg.isDistinct() ? ASTBuilder.construct(HiveParser.TOK_FUNCTIONDI,
    "TOK_FUNCTIONDI") : argCount == 0 ? ASTBuilder.construct(HiveParser.TOK_FUNCTIONSTAR,
    "TOK_FUNCTIONSTAR") : ASTBuilder.construct(HiveParser.TOK_FUNCTION, "TOK_FUNCTION");
  b.add(HiveParser.Identifier, agg.getAggregation().getName());
  for (int i : agg.getArgList()) {
   RexInputRef iRef = new RexInputRef(i, gBy.getCluster().getTypeFactory()
     .createSqlType(SqlTypeName.ANY));
   b.add(iRef.accept(new RexVisitor(src, false, gBy.getCluster().getRexBuilder())));
  }
  add(new ColumnInfo(null, b.node()));
 }
}

相关文章