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


Java RelNode.getConvention方法代码示例

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


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

示例1: visit

import org.apache.calcite.rel.RelNode; //导入方法依赖的package包/类
public boolean visit(final RelNode node) {
  for (RelNode input : node.getInputs()) {
    if (visit(input)) {
      return true;
    }
  }

  if (node.getConvention() instanceof JdbcConventionIndicator) {
    return false;
  }

  final RexSubQueryFinder subQueryFinder = new RexSubQueryFinder();
  node.accept(subQueryFinder);
  if (subQueryFinder.getFoundSubQuery()) {
    return true;
  }
  return false;
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:19,代码来源:RexSubQueryUtils.java

示例2: canConvert

import org.apache.calcite.rel.RelNode; //导入方法依赖的package包/类
@Override
public boolean canConvert(
    RelOptPlanner planner, DistributionTrait fromTrait, DistributionTrait toTrait, RelNode fromRel) {
  if (fromTrait.equals(toTrait)) {
    return true;
  }

  // Source trait is "ANY", which is abstract type of distribution.
  // We do not want to convert from "ANY", since it's abstract.
  // Source trait should be concrete type: SINGLETON, HASH_DISTRIBUTED, etc.
  if (fromTrait.equals(DistributionTrait.DEFAULT) && !(fromRel instanceof RelSubset) ) {
    return false;
  }

  // It is only possible to apply a distribution trait to a PHYSICAL convention.
  if (fromRel.getConvention() != Prel.PHYSICAL) {
    return false;
  }

  if (fromTrait.getType() == DistributionType.HASH_DISTRIBUTED && toTrait.getType() == DistributionType.BROADCAST_DISTRIBUTED) {
    return false;
  }
  if (fromTrait.getType() == DistributionType.BROADCAST_DISTRIBUTED && toTrait.getType() == DistributionType.HASH_DISTRIBUTED) {
    return false;
  }

  return true;
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:29,代码来源:DistributionTraitDef.java

示例3: visitChild

import org.apache.calcite.rel.RelNode; //导入方法依赖的package包/类
@Override
protected RelNode visitChild(RelNode parent, int i, RelNode child) {
  RelNode newParent = parent;
  if (parent.getConvention() instanceof JdbcConventionIndicator) {
    transformer.setTraitSet(parent.getTraitSet().plus(DistributionTrait.ANY).plus(RelCollations.EMPTY));
    newParent = parent.accept(transformer);
  }
  return super.visitChild(newParent, i, newParent.getInput(i));
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:10,代码来源:RexSubQueryUtils.java

示例4: convert

import org.apache.calcite.rel.RelNode; //导入方法依赖的package包/类
@Override
public RelNode convert(
    RelOptPlanner planner,
    RelNode rel,
    DrillDistributionTrait toDist,
    boolean allowInfiniteCostConverters) {

  DrillDistributionTrait currentDist = rel.getTraitSet().getTrait(DrillDistributionTraitDef.INSTANCE);

  // Source and Target have the same trait.
  if (currentDist.equals(toDist)) {
    return rel;
  }

  // Source trait is "ANY", which is abstract type of distribution.
  // We do not want to convert from "ANY", since it's abstract.
  // Source trait should be concrete type: SINGLETON, HASH_DISTRIBUTED, etc.
  if (currentDist.equals(DrillDistributionTrait.DEFAULT) && !(rel instanceof RelSubset) ) {
      return null;
  }

  // It is only possible to apply a distribution trait to a DRILL_PHYSICAL convention.
  if (rel.getConvention() != Prel.DRILL_PHYSICAL) {
    return null;
  }

  switch(toDist.getType()){
    // UnionExchange, HashToRandomExchange, OrderedPartitionExchange and BroadcastExchange destroy the ordering property,
    // therefore RelCollation is set to default, which is EMPTY.
    case SINGLETON:
      return new UnionExchangePrel(rel.getCluster(), planner.emptyTraitSet().plus(Prel.DRILL_PHYSICAL).plus(toDist), rel);
    case HASH_DISTRIBUTED:
      return new HashToRandomExchangePrel(rel.getCluster(), planner.emptyTraitSet().plus(Prel.DRILL_PHYSICAL).plus(toDist), rel,
                                           toDist.getFields());
    case RANGE_DISTRIBUTED:
      return new OrderedPartitionExchangePrel(rel.getCluster(), planner.emptyTraitSet().plus(Prel.DRILL_PHYSICAL).plus(toDist), rel);
    case BROADCAST_DISTRIBUTED:
      return new BroadcastExchangePrel(rel.getCluster(), planner.emptyTraitSet().plus(Prel.DRILL_PHYSICAL).plus(toDist), rel);
    case ANY:
      // If target is "any", any input would satisfy "any". Return input directly.
      return rel;
    default:
      return null;
  }
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:46,代码来源:DrillDistributionTraitDef.java


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