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


Java RelNode.getTraitSet方法代码示例

本文整理汇总了Java中org.apache.calcite.rel.RelNode.getTraitSet方法的典型用法代码示例。如果您正苦于以下问题:Java RelNode.getTraitSet方法的具体用法?Java RelNode.getTraitSet怎么用?Java RelNode.getTraitSet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.calcite.rel.RelNode的用法示例。


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

示例1: onMatch

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

  final List<Integer> keys = writer.getPartitionKeys();
  final RelCollation collation = getCollation(keys);
  final boolean hashDistribute = PrelUtil.getPlannerSettings(call.getPlanner()).getOptions().getOption(ExecConstants.CTAS_PARTITIONING_HASH_DISTRIBUTE_VALIDATOR);
  final RelTraitSet traits = hashDistribute ?
      input.getTraitSet().plus(Prel.DRILL_PHYSICAL).plus(collation).plus(getDistribution(keys)) :
      input.getTraitSet().plus(Prel.DRILL_PHYSICAL).plus(collation);

  final RelNode convertedInput = convert(input, traits);

  if (!new WriteTraitPull(call).go(writer, convertedInput)) {
    DrillWriterRelBase newWriter = new WriterPrel(writer.getCluster(), convertedInput.getTraitSet(),
        convertedInput, writer.getCreateTableEntry());

    call.transformTo(newWriter);
  }
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:22,代码来源:WriterPrule.java

示例2: onMatch

import org.apache.calcite.rel.RelNode; //导入方法依赖的package包/类
@Override
public void onMatch(RelOptRuleCall call) {
  final LimitPrel limit = (LimitPrel) call.rel(0);
  final UnionExchangePrel unionExchangePrel = (UnionExchangePrel) call.rel(1);

  RelNode child = unionExchangePrel.getInput();

  final int offset = limit.getOffset() != null ? Math.max(0, RexLiteral.intValue(limit.getOffset())) : 0;
  final int fetch = Math.max(0, RexLiteral.intValue(limit.getFetch()));

  // child Limit uses conservative approach:  use offset 0 and fetch = parent limit offset + parent limit fetch.
  final RexNode childFetch = limit.getCluster().getRexBuilder().makeExactLiteral(BigDecimal.valueOf(offset + fetch));

  final RelNode limitUnderExchange = new LimitPrel(child.getCluster(), child.getTraitSet(), child, null, childFetch);
  final RelNode newUnionExch = new UnionExchangePrel(unionExchangePrel.getCluster(), unionExchangePrel.getTraitSet(), limitUnderExchange);
  final RelNode limitAboveExchange = new LimitPrel(limit.getCluster(), limit.getTraitSet(), newUnionExch, limit.getOffset(), limit.getFetch(), true);

  call.transformTo(limitAboveExchange);
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:20,代码来源:LimitUnionExchangeTransposeRule.java

示例3: rename

import org.apache.calcite.rel.RelNode; //导入方法依赖的package包/类
private RelNode rename(RelNode input, List<RelDataTypeField> inputFields, List<String> outputFieldNames) {
  List<RexNode> exprs = Lists.newArrayList();

  for (RelDataTypeField field : inputFields) {
    RexNode expr = input.getCluster().getRexBuilder().makeInputRef(field.getType(), field.getIndex());
    exprs.add(expr);
  }

  RelDataType rowType = RexUtil.createStructType(input.getCluster().getTypeFactory(), exprs, outputFieldNames);

  ProjectPrel proj = new ProjectPrel(input.getCluster(), input.getTraitSet(), input, exprs, rowType);

  return proj;
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:15,代码来源:JoinPrel.java

示例4: createJoin

import org.apache.calcite.rel.RelNode; //导入方法依赖的package包/类
@Override
public RelNode createJoin(RelNode left, RelNode right,
                          RexNode condition,
                          Set<CorrelationId> variablesSet,
                          JoinRelType joinType, boolean semiJoinDone) {
  return new JoinRel(left.getCluster(), left.getTraitSet(), left, right, condition, joinType);
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:8,代码来源:DremioRelFactories.java

示例5: onMatch

import org.apache.calcite.rel.RelNode; //导入方法依赖的package包/类
@Override
public void onMatch(RelOptRuleCall call) {
  final FlattenRel flatten = call.rel(0);
  final RelNode input = flatten.getInput();
  RelNode convertedInput = convert(input, input.getTraitSet().replace(Prel.PHYSICAL));

  FlattenPrel toTransform = null;
  for (RexNode rex : flatten.getToFlatten()) {
    toTransform = new FlattenPrel(flatten.getCluster(), convertedInput.getTraitSet(), convertedInput, rex);
    convertedInput = toTransform;
  }
  call.transformTo(toTransform);
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:14,代码来源:FlattenPrule.java

示例6: merge

import org.apache.calcite.rel.RelNode; //导入方法依赖的package包/类
/**
 * Merges this limit with an ElasticsearchSample operator.
 * @param sample
 * @param treeWithoutLimit
 * @return
 */
public ElasticsearchLimit merge(ElasticsearchSample sample, RelNode treeWithoutLimit){
  if(sample == null){
    return this;
  }

  long sampleSize = SampleCrel.getSampleSizeAndSetMinSampleSize(PrelUtil.getPlannerSettings(getCluster().getPlanner()), ElasticSampleRule.SAMPLE_SIZE_DENOMINATOR);
  int limitAmount = RexLiteral.intValue(getFetch());
  int finalLimit = Math.min((int) sampleSize,  limitAmount);
  RexNode offset = getCluster().getRexBuilder().makeExactLiteral(BigDecimal.valueOf(0), getCluster().getTypeFactory().createSqlType(SqlTypeName.INTEGER));
  RexNode fetch = getCluster().getRexBuilder().makeExactLiteral(BigDecimal.valueOf(finalLimit), getCluster().getTypeFactory().createSqlType(SqlTypeName.INTEGER));
  return new ElasticsearchLimit(getCluster(), treeWithoutLimit.getTraitSet(), treeWithoutLimit, offset, fetch, isPushDown(), getPluginId());
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:19,代码来源:ElasticsearchLimit.java

示例7: createJoin

import org.apache.calcite.rel.RelNode; //导入方法依赖的package包/类
@Override
public RelNode createJoin(RelNode left, RelNode right,
                          RexNode condition, JoinRelType joinType,
                          Set<String> variablesStopped, boolean semiJoinDone) {
  return new DrillJoinRel(left.getCluster(), left.getTraitSet(), left, right, condition, joinType);
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:7,代码来源:DrillRelFactories.java

示例8: create

import org.apache.calcite.rel.RelNode; //导入方法依赖的package包/类
public static DrillFilterRel create(RelNode child, RexNode condition) {
  return new DrillFilterRel(child.getCluster(), child.getTraitSet(), child, condition)  ;
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:4,代码来源:DrillFilterRel.java

示例9: convertChild

import org.apache.calcite.rel.RelNode; //导入方法依赖的package包/类
@Override
public RelNode convertChild(DrillFilterRel filter, RelNode rel) {
  return new FilterPrel(filter.getCluster(), rel.getTraitSet(), rel, filter.getCondition());
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:5,代码来源:FilterPrule.java

示例10: ProducerConsumerPrel

import org.apache.calcite.rel.RelNode; //导入方法依赖的package包/类
public ProducerConsumerPrel(RelNode child, int queueSize) {
  super(child.getCluster(), child.getTraitSet(), child);
  this.queueSize = queueSize;
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:5,代码来源:ProducerConsumerPrel.java

示例11: create

import org.apache.calcite.rel.RelNode; //导入方法依赖的package包/类
public static FilterRel create(RelNode child, RexNode condition) {
  return new FilterRel(child.getCluster(), child.getTraitSet(), child, condition)  ;
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:4,代码来源:FilterRel.java

示例12: convertChild

import org.apache.calcite.rel.RelNode; //导入方法依赖的package包/类
@Override
public RelNode convertChild(FilterRel filter, RelNode rel) {
  return new FilterPrel(filter.getCluster(), rel.getTraitSet(), rel, filter.getCondition());
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:5,代码来源:FilterPrule.java


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