当前位置: 首页>>代码示例>>Java>>正文


Java RelTraitSet类代码示例

本文整理汇总了Java中org.apache.calcite.plan.RelTraitSet的典型用法代码示例。如果您正苦于以下问题:Java RelTraitSet类的具体用法?Java RelTraitSet怎么用?Java RelTraitSet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


RelTraitSet类属于org.apache.calcite.plan包,在下文中一共展示了RelTraitSet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onMatch

import org.apache.calcite.plan.RelTraitSet; //导入依赖的package包/类
@Override
public void onMatch(RelOptRuleCall call) {
  final LogicalAggregate aggregate = (LogicalAggregate) call.rel(0);
  final RelNode input = call.rel(1);

  if (aggregate.containsDistinctCall()) {
    // currently, don't use this rule if any of the aggregates contains DISTINCT
    return;
  }

  final RelTraitSet traits = aggregate.getTraitSet().plus(DrillRel.DRILL_LOGICAL);
  final RelNode convertedInput = convert(input, input.getTraitSet().plus(DrillRel.DRILL_LOGICAL));
  try {
    call.transformTo(new DrillAggregateRel(aggregate.getCluster(), traits, convertedInput, aggregate.indicator,
        aggregate.getGroupSet(), aggregate.getGroupSets(), aggregate.getAggCallList()));
  } catch (InvalidRelException e) {
    tracer.warning(e.toString());
  }
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:20,代码来源:DrillAggregateRule.java

示例2: onMatch

import org.apache.calcite.plan.RelTraitSet; //导入依赖的package包/类
@Override
public void onMatch(RelOptRuleCall call) {
  final UnionRel union = (UnionRel) call.rel(0);
  final List<RelNode> inputs = union.getInputs();
  List<RelNode> convertedInputList = Lists.newArrayList();
  RelTraitSet traits = call.getPlanner().emptyTraitSet().plus(Prel.PHYSICAL);

  try {
    for (int i = 0; i < inputs.size(); i++) {
      RelNode convertedInput = convert(inputs.get(i), PrelUtil.fixTraits(call, traits));
      convertedInputList.add(convertedInput);
    }

    traits = call.getPlanner().emptyTraitSet().plus(Prel.PHYSICAL).plus(DistributionTrait.SINGLETON);
    UnionDistinctPrel unionDistinct =
        new UnionDistinctPrel(union.getCluster(), traits, convertedInputList,
            false /* compatibility already checked during logical phase */);

    call.transformTo(unionDistinct);

  } catch (InvalidRelException e) {
    tracer.warn(e.toString());
  }
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:25,代码来源:UnionDistinctPrule.java

示例3: onMatch

import org.apache.calcite.plan.RelTraitSet; //导入依赖的package包/类
@Override
public void onMatch(RelOptRuleCall call) {
  final LogicalUnion union = (LogicalUnion) call.rel(0);

  // This rule applies to Union-All only
  if(!union.all) {
    return;
  }

  final RelTraitSet traits = union.getTraitSet().plus(DrillRel.DRILL_LOGICAL);
  final List<RelNode> convertedInputs = new ArrayList<>();
  for (RelNode input : union.getInputs()) {
    final RelNode convertedInput = convert(input, input.getTraitSet().plus(DrillRel.DRILL_LOGICAL));
    convertedInputs.add(convertedInput);
  }
  try {
    call.transformTo(new DrillUnionRel(union.getCluster(), traits, convertedInputs, union.all,
        true /* check compatibility */));
  } catch (InvalidRelException e) {
    tracer.warning(e.toString()) ;
  }
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:23,代码来源:DrillUnionAllRule.java

示例4: onMatch

import org.apache.calcite.plan.RelTraitSet; //导入依赖的package包/类
@Override
public void onMatch(RelOptRuleCall call) {
  final DrillUnionRel union = (DrillUnionRel) call.rel(0);
  final List<RelNode> inputs = union.getInputs();
  List<RelNode> convertedInputList = Lists.newArrayList();
  RelTraitSet traits = call.getPlanner().emptyTraitSet().plus(Prel.DRILL_PHYSICAL);

  try {
    for (int i = 0; i < inputs.size(); i++) {
      RelNode convertedInput = convert(inputs.get(i), PrelUtil.fixTraits(call, traits));
      convertedInputList.add(convertedInput);
    }

    traits = call.getPlanner().emptyTraitSet().plus(Prel.DRILL_PHYSICAL).plus(DrillDistributionTrait.SINGLETON);
    UnionDistinctPrel unionDistinct =
        new UnionDistinctPrel(union.getCluster(), traits, convertedInputList,
            false /* compatibility already checked during logical phase */);

    call.transformTo(unionDistinct);

  } catch (InvalidRelException e) {
    tracer.warning(e.toString());
  }
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:25,代码来源:UnionDistinctPrule.java

示例5: onMatch

import org.apache.calcite.plan.RelTraitSet; //导入依赖的package包/类
@Override
public void onMatch(RelOptRuleCall call) {
  final DrillSortRel sort = (DrillSortRel) call.rel(0);
  final RelNode input = sort.getInput();

  // Keep the collation in logical sort. Convert input into a RelNode with 1) this collation, 2) Physical, 3) hash distributed on

  DrillDistributionTrait hashDistribution =
      new DrillDistributionTrait(DrillDistributionTrait.DistributionType.HASH_DISTRIBUTED, ImmutableList.copyOf(getDistributionField(sort)));

  final RelTraitSet traits = sort.getTraitSet().plus(Prel.DRILL_PHYSICAL).plus(hashDistribution);

  final RelNode convertedInput = convert(input, traits);

  if(isSingleMode(call)){
    call.transformTo(convertedInput);
  }else{
    RelNode exch = new SingleMergeExchangePrel(sort.getCluster(), sort.getTraitSet().plus(Prel.DRILL_PHYSICAL).plus(DrillDistributionTrait.SINGLETON), convertedInput, sort.getCollation());
    call.transformTo(exch);  // transform logical "sort" into "SingleMergeExchange".

  }

}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:24,代码来源:SortPrule.java

示例6: onMatch

import org.apache.calcite.plan.RelTraitSet; //导入依赖的package包/类
@Override
public void onMatch(RelOptRuleCall call) {
  final LogicalUnion union = (LogicalUnion) call.rel(0);

  // This rule applies to Union-All only
  if(!union.all) {
    return;
  }

  final RelTraitSet traits = union.getTraitSet().plus(Rel.LOGICAL);
  final List<RelNode> convertedInputs = new ArrayList<>();
  for (RelNode input : union.getInputs()) {
    final RelNode convertedInput = convert(input, input.getTraitSet().plus(Rel.LOGICAL).simplify());
    convertedInputs.add(convertedInput);
  }
  try {
    call.transformTo(new UnionRel(union.getCluster(), traits, convertedInputs, union.all,
        true /* check compatibility */));
  } catch (InvalidRelException e) {
    tracer.warn(e.toString()) ;
  }
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:23,代码来源:UnionAllRule.java

示例7: createTransformRequest

import org.apache.calcite.plan.RelTraitSet; //导入依赖的package包/类
private void createTransformRequest(RelOptRuleCall call, AggregateRel aggregate,
                                    RelNode input, RelTraitSet traits) throws InvalidRelException {

  final RelNode convertedInput = convert(input, traits);

  StreamAggPrel newAgg = new StreamAggPrel(
      aggregate.getCluster(),
      traits,
      convertedInput,
      aggregate.indicator,
      aggregate.getGroupSet(),
      aggregate.getGroupSets(),
      aggregate.getAggCallList(),
      OperatorPhase.PHASE_1of1);

  call.transformTo(newAgg);
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:18,代码来源:StreamAggPrule.java

示例8: onMatch

import org.apache.calcite.plan.RelTraitSet; //导入依赖的package包/类
@Override
public void onMatch(RelOptRuleCall call) {
  final DrillProjectRel project = (DrillProjectRel) call.rel(0);
  final RelNode input = project.getInput();

  RelTraitSet traits = input.getTraitSet().plus(Prel.DRILL_PHYSICAL);
  RelNode convertedInput = convert(input, traits);

  // Maintain two different map for distribution trait and collation trait.
  // For now, the only difference comes from the way how cast function impacts propagating trait.
  final Map<Integer, Integer> distributionMap = getDistributionMap(project);
  final Map<Integer, Integer> collationMap = getCollationMap(project);

  boolean traitPull = new ProjectTraitPull(call, distributionMap, collationMap).go(project, convertedInput);

  if(!traitPull){
    call.transformTo(new ProjectPrel(project.getCluster(), convertedInput.getTraitSet(), convertedInput, project.getProjects(), project.getRowType()));
  }
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:20,代码来源:ProjectPrule.java

示例9: traits

import org.apache.calcite.plan.RelTraitSet; //导入依赖的package包/类
private static RelTraitSet traits(
    RelOptCluster cluster,
    double rowCount,
    int splitCount,
    RelTraitSet traitSet) {
  PlannerSettings settings = PrelUtil.getPlannerSettings(cluster.getPlanner());
  boolean smallInput = rowCount < (double)settings.getSliceTarget();

  DistributionTrait distribution;
  if(settings.isMultiPhaseAggEnabled() && !settings.isSingleMode() && !smallInput && splitCount > 1) {
    distribution = DistributionTrait.ANY;
  } else {
    distribution = DistributionTrait.SINGLETON;
  }

  return traitSet.plus(distribution);
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:18,代码来源:ElasticIntermediateScanPrel.java

示例10: DrillWindowRel

import org.apache.calcite.plan.RelTraitSet; //导入依赖的package包/类
/**
 * Creates a window relational expression.
 *
 * @param cluster Cluster
 * @param traits
 * @param child   Input relational expression
 * @param rowType Output row type
 * @param groups Windows
 */
public DrillWindowRel(
    RelOptCluster cluster,
    RelTraitSet traits,
    RelNode child,
    List<RexLiteral> constants,
    RelDataType rowType,
    List<Group> groups) {
  super(cluster, traits, child, constants, rowType, groups);
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:19,代码来源:DrillWindowRel.java

示例11: onMatch

import org.apache.calcite.plan.RelTraitSet; //导入依赖的package包/类
@Override
public void onMatch(RelOptRuleCall call) {
  final Sort incomingSort = call.rel(0);
  final RelTraitSet incomingTraits = incomingSort.getTraitSet();
  RelNode input = incomingSort.getInput();

  // if the Optiq sort rel includes a collation and a limit, we need to create a copy the sort rel that excludes the
  // limit information.
  if (!incomingSort.getCollation().getFieldCollations().isEmpty()) {
    input = incomingSort.copy(incomingTraits, input, incomingSort.getCollation(), null, null);
  }

  RelNode convertedInput = convert(input, input.getTraitSet().plus(DrillRel.DRILL_LOGICAL));
  call.transformTo(new DrillLimitRel(incomingSort.getCluster(), convertedInput.getTraitSet().plus(DrillRel.DRILL_LOGICAL), convertedInput, incomingSort.offset, incomingSort.fetch));
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:16,代码来源:DrillLimitRule.java

示例12: ElasticIntermediateScanPrel

import org.apache.calcite.plan.RelTraitSet; //导入依赖的package包/类
public ElasticIntermediateScanPrel(
    RelOptCluster cluster,
    RelTraitSet traitSet,
    RelOptTable table,
    TableMetadata dataset,
    List<SchemaPath> projectedColumns,
    double observedRowcountAdjustment) {
  super(cluster, traits(cluster, table.getRowCount(), dataset.getSplitCount(), traitSet), table, dataset.getStoragePluginId(), dataset, projectedColumns, observedRowcountAdjustment);
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:10,代码来源:ElasticIntermediateScanPrel.java

示例13: DrillJoinRel

import org.apache.calcite.plan.RelTraitSet; //导入依赖的package包/类
/** Creates a DrillJoinRel.
 * We do not throw InvalidRelException in Logical planning phase. It's up to the post-logical planning check or physical planning
 * to detect the unsupported join type, and throw exception.
 * */
public DrillJoinRel(RelOptCluster cluster, RelTraitSet traits, RelNode left, RelNode right, RexNode condition,
    JoinRelType joinType)  {
  super(cluster, traits, left, right, condition, joinType);
  assert traits.contains(DrillRel.DRILL_LOGICAL);
  RelOptUtil.splitJoinCondition(left, right, condition, leftKeys, rightKeys);
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:11,代码来源:DrillJoinRel.java

示例14: OldScanRelBase

import org.apache.calcite.plan.RelTraitSet; //导入依赖的package包/类
/**
 * Creates an <code>AbstractRelNode</code>.
 *
 * @param cluster
 * @param traitSet
 */
public OldScanRelBase(RelOptCluster cluster, RelTraitSet traitSet, RelOptTable relOptTable, RelDataType rowType, GroupScan groupScan, double discountRowCount) {
  super(cluster, traitSet, relOptTable);
  this.rowType = Preconditions.checkNotNull(rowType);
  this.groupScan = Preconditions.checkNotNull(groupScan);
  Preconditions.checkArgument(discountRowCount >= 0 && discountRowCount <= 1, "rowCountDiscount cannot be set to " + discountRowCount);
  this.rowCountDiscount = discountRowCount;
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:14,代码来源:OldScanRelBase.java

示例15: DrillFilterRelBase

import org.apache.calcite.plan.RelTraitSet; //导入依赖的package包/类
protected DrillFilterRelBase(Convention convention, RelOptCluster cluster, RelTraitSet traits, RelNode child, RexNode condition) {
  super(cluster, traits, child, condition);
  assert getConvention() == convention;

  // save the number of conjuncts that make up the filter condition such
  // that repeated calls to the costing function can use the saved copy
  conjunctions = RelOptUtil.conjunctions(condition);
  numConjuncts = conjunctions.size();
  // assert numConjuncts >= 1;

}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:12,代码来源:DrillFilterRelBase.java


注:本文中的org.apache.calcite.plan.RelTraitSet类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。