本文整理汇总了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);
}
示例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;
}
示例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;
}
示例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;
}
}
示例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;
}
示例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);
}
示例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);
}
示例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) ;
}
示例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);
}
示例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;
}
}
示例11: ProducerConsumerPrel
import org.apache.calcite.rel.RelNode; //导入方法依赖的package包/类
public ProducerConsumerPrel(RelNode child, int queueSize) {
super(child.getCluster(), child.getTraitSet(), child);
this.queueSize = queueSize;
}
示例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) ;
}
示例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());
}
示例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);
}
示例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);
}