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


Java RelNode.getCluster方法代码示例

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


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

示例1: 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

示例2: createProject

import org.apache.calcite.rel.RelNode; //导入方法依赖的package包/类
@Override
public RelNode createProject(RelNode child,
                             List<? extends RexNode> childExprs, List<String> fieldNames) {
  final RelOptCluster cluster = child.getCluster();
  final RelDataType rowType = RexUtil.createStructType(cluster.getTypeFactory(), childExprs, fieldNames);
  final RelNode project = DrillProjectRel.create(cluster, child.getTraitSet(), child, childExprs, rowType);

  return project;
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:10,代码来源:DrillRelFactories.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:dremio,项目名称:dremio-oss,代码行数:15,代码来源:JoinPrel.java

示例4: convert

import org.apache.calcite.rel.RelNode; //导入方法依赖的package包/类
@Override
public RelNode convert(
    RelOptPlanner planner,
    RelNode rel,
    DistributionTrait toDist,
    boolean allowInfiniteCostConverters) {
  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.PHYSICAL).plus(toDist), rel);
    case HASH_DISTRIBUTED:
      return new HashToRandomExchangePrel(rel.getCluster(), planner.emptyTraitSet().plus(Prel.PHYSICAL).plus(toDist), rel,
                                           toDist.getFields());
    case RANGE_DISTRIBUTED:
      return new OrderedPartitionExchangePrel(rel.getCluster(), planner.emptyTraitSet().plus(Prel.PHYSICAL).plus(toDist), rel);
    case BROADCAST_DISTRIBUTED:
      return new BroadcastExchangePrel(rel.getCluster(), planner.emptyTraitSet().plus(Prel.PHYSICAL).plus(toDist), rel);
    case ROUND_ROBIN_DISTRIBUTED:
      return new RoundRobinExchangePrel(rel.getCluster(), planner.emptyTraitSet().plus(Prel.PHYSICAL).plus(toDist), rel);
    case ANY:
      // If target is "any", any input would satisfy "any". Return input directly.
      return rel;
    default:
      return null;
  }
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:28,代码来源:DistributionTraitDef.java

示例5: createProject

import org.apache.calcite.rel.RelNode; //导入方法依赖的package包/类
@Override
public RelNode createProject(RelNode child,
                             List<? extends RexNode> childExprs, List<String> fieldNames) {
  final RelOptCluster cluster = child.getCluster();
  final RelDataType rowType = RexUtil.createStructType(cluster.getTypeFactory(), childExprs, fieldNames, SqlValidatorUtil.F_SUGGESTER);
  final RelNode project = ProjectRel.create(cluster, child.getTraitSet().plus(Rel.LOGICAL), child, childExprs, rowType);

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

示例6: 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

示例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: create

import org.apache.calcite.rel.RelNode; //导入方法依赖的package包/类
public static ScanPrel create(RelNode old, RelTraitSet traitSets,
    GroupScan scan, RelDataType rowType) {
  return new ScanPrel(old.getCluster(), traitSets, getCopy(scan), rowType);
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:5,代码来源:ScanPrel.java

示例10: 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

示例11: 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

示例12: 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

示例13: convert

import org.apache.calcite.rel.RelNode; //导入方法依赖的package包/类
public RelNode convert(RelNode rel) {
  LogicalProject project = (LogicalProject) rel;
  return new JdbcRules.JdbcProject(rel.getCluster(), rel.getTraitSet().replace(this.out), convert(
      project.getInput(), project.getInput().getTraitSet().replace(this.out)), project.getProjects(),
      project.getRowType());
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:7,代码来源:DrillJdbcRuleBase.java

示例14: create

import org.apache.calcite.rel.RelNode; //导入方法依赖的package包/类
public static SampleCrel create(RelNode input) {
  final RelCollation collation = RelCollationTraitDef.INSTANCE.canonize(RelCollations.EMPTY);
  final RelTraitSet newTraitSet = input.getTraitSet().replace(Convention.NONE).replace(collation);
  return new SampleCrel(input.getCluster(), newTraitSet, input);
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:6,代码来源:SampleCrel.java

示例15: create

import org.apache.calcite.rel.RelNode; //导入方法依赖的package包/类
public static OldScanPrel create(RelNode old, RelTraitSet traitSets,
    GroupScan scan, RelDataType rowType, List<String> qualifiedTableName) {
  return new OldScanPrel(old.getCluster(), traitSets, getCopy(scan), rowType, qualifiedTableName);
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:5,代码来源:OldScanPrel.java


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