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

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

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

Aggregate.getRowType介绍

暂无

代码示例

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

List<List<Integer>> cleanArgList, Map<Integer, Integer> map,
 List<Integer> sourceOfForCountDistinct) throws CalciteSemanticException {
List<RexNode> originalInputRefs = Lists.transform(aggr.getRowType().getFieldList(),
  new Function<RelDataTypeField, RexNode>() {
   @Override
 return aggregate;
} else {
 List<RexNode> originalAggrRefs = Lists.transform(aggregate.getRowType().getFieldList(),
   new Function<RelDataTypeField, RexNode>() {
    @Override

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

aggregate.getRowType()
);

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

public void onMatch(RelOptRuleCall call) {
 final LogicalCorrelate correlate = call.rel(0);
 final RelNode left = call.rel(1);
 final Project aggOutputProject;
 final Aggregate aggregate;
 if (flavor) {
  aggOutputProject = call.rel(2);
  aggregate = call.rel(3);
 } else {
  aggregate = call.rel(2);
  // Create identity projection
  final List<Pair<RexNode, String>> projects = Lists.newArrayList();
  final List<RelDataTypeField> fields =
      aggregate.getRowType().getFieldList();
  for (int i = 0; i < fields.size(); i++) {
   projects.add(RexInputRef.of2(projects.size(), fields));
  }
  aggOutputProject = (Project) RelOptUtil.createProject(
    aggregate, Pair.left(projects), Pair.right(projects), false, relBuilder);
 }
 onMatch2(call, correlate, left, aggOutputProject, aggregate);
}

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

projList.add(
   rexBuilder.makeInputRef(
     aggRel.getRowType().getFieldList().get(i).getType(), i));
for (int i = offset; i < aggRel.getRowType().getFieldCount(); ++i) {
 projList.add(
   rexBuilder.makeInputRef(
     aggRel.getRowType().getFieldList().get(i).getType(), indexes.get(i-offset)));

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

List<List<Integer>> cleanArgList, Map<Integer, Integer> map,
 List<Integer> sourceOfForCountDistinct) throws CalciteSemanticException {
List<RexNode> originalInputRefs = Lists.transform(aggr.getRowType().getFieldList(),
  new Function<RelDataTypeField, RexNode>() {
   @Override
 return aggregate;
} else {
 List<RexNode> originalAggrRefs = Lists.transform(aggregate.getRowType().getFieldList(),
   new Function<RelDataTypeField, RexNode>() {
    @Override

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

if (fieldCount != aggregate.getRowType().getFieldCount()) {
 throw new ISE(
   "WTF, expected[%s] to have[%s] fields but it had[%s]",
   aggregate,
   fieldCount,
   aggregate.getRowType().getFieldCount()
 );
   fixUpProjects.add(rexBuilder.makeInputRef(newAggregate, j++));
  } else {
   fixUpProjects.add(rexBuilder.makeNullLiteral(aggregate.getRowType().getFieldList().get(i).getType()));

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

relBuilder.project(projList, oldAggRel.getRowType().getFieldNames())
  .convert(oldAggRel.getRowType(), false);
ruleCall.transformTo(relBuilder.build());

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

final RelDataType oldType = aggregate.getRowType().getFieldList().get(i).getType();
if (newCall == null) {
 newCasts.add(rexBuilder.makeInputRef(oldType, i));

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

input.getRowType().getFieldCount(), agg.getRowType().getFieldCount());

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

input.getRowType().getFieldCount(), agg.getRowType().getFieldCount());

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

i < newAggregate.getRowType().getFieldCount(); i++) {
posList.add(i);

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

b:
 if (allColumnsInAggregate && newAggCalls.isEmpty() &&
  RelOptUtil.areRowTypesEqual(r.getRowType(), aggregate.getRowType(), false)) {

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

final RelDataType rowType = aggregate.getRowType();

代码示例来源:origin: Qihoo360/Quicksql

public boolean isValid(Litmus litmus, Context context) {
 return super.isValid(litmus, context)
   && litmus.check(Util.isDistinct(getRowType().getFieldNames()),
     "distinct field names: {}", getRowType());
}

代码示例来源:origin: org.apache.calcite/calcite-core

public boolean isValid(Litmus litmus, Context context) {
 return super.isValid(litmus, context)
   && litmus.check(Util.isDistinct(getRowType().getFieldNames()),
     "distinct field names: {}", getRowType());
}

代码示例来源:origin: org.apache.calcite/calcite-core

/** Implementation of {@link ColType#getColType(int)} for
  * {@link org.apache.calcite.rel.logical.LogicalAggregate}, called via
  * reflection. */
 @SuppressWarnings("UnusedDeclaration")
 public String getColType(Aggregate rel, RelMetadataQuery mq, int column) {
  final String name =
    rel.getRowType().getFieldList().get(column).getName() + "-agg";
  THREAD_LIST.get().add(name);
  return name;
 }
}

代码示例来源:origin: Qihoo360/Quicksql

/** Implementation of {@link ColType#getColType(int)} for
  * {@link org.apache.calcite.rel.logical.LogicalAggregate}, called via
  * reflection. */
 @SuppressWarnings("UnusedDeclaration")
 public String getColType(Aggregate rel, RelMetadataQuery mq, int column) {
  final String name =
    rel.getRowType().getFieldList().get(column).getName() + "-agg";
  THREAD_LIST.get().add(name);
  return name;
 }
}

代码示例来源:origin: Qihoo360/Quicksql

/**
 * 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));
}

代码示例来源:origin: org.apache.calcite/calcite-core

/**
 * 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));
}

代码示例来源:origin: com.alibaba.blink/flink-table

public void onMatch(RelOptRuleCall call) {
    final Aggregate aggregate = call.rel(0);
    final RelNode input = call.rel(1);

    // Distinct is "GROUP BY c1, c2" (where c1, c2 are a set of columns on
    // which the input is unique, i.e. contain a key) and has no aggregate
    // functions or the functions we enumerated. It can be removed.
    final RelNode newInput = convert(input, aggregate.getTraitSet().simplify());

    // If aggregate was projecting a subset of columns, add a project for the
    // same effect.
    final RelBuilder relBuilder = call.builder();
    relBuilder.push(newInput);
    List<Integer> projectIndices = new ArrayList<>(aggregate.getGroupSet().asList());
    for (AggregateCall aggCall : aggregate.getAggCallList()) {
      projectIndices.addAll(aggCall.getArgList());
    }
    relBuilder.project(relBuilder.fields(projectIndices));
    // Create a project if some of the columns have become
    // NOT NULL due to aggregate functions are removed
    relBuilder.convert(aggregate.getRowType(), true);
    call.transformTo(relBuilder.build());
  }
}

相关文章