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