use of org.apache.calcite.plan.RelTraitSet in project storm by apache.
the class QueryPlanner method convertToStormRel.
private RelNode convertToStormRel(RelNode relNode) throws RelConversionException {
RelTraitSet traitSet = relNode.getTraitSet();
traitSet = traitSet.simplify();
// PlannerImpl.transform() optimizes RelNode with ruleset
return planner.transform(STORM_REL_CONVERSION_RULES, traitSet.plus(TridentLogicalConvention.INSTANCE), relNode);
}
use of org.apache.calcite.plan.RelTraitSet in project hive by apache.
the class HiveSortExchange method create.
/**
* Creates a HiveSortExchange.
*
* @param input Input relational expression
* @param distribution Distribution specification
* @param collation Collation specification
* @param joinKeys Join Keys specification
*/
public static HiveSortExchange create(RelNode input, RelDistribution distribution, RelCollation collation, ImmutableList<RexNode> joinKeys) {
RelOptCluster cluster = input.getCluster();
distribution = RelDistributionTraitDef.INSTANCE.canonize(distribution);
collation = RelCollationTraitDef.INSTANCE.canonize(collation);
RelTraitSet traitSet = RelTraitSet.createEmpty().plus(distribution).plus(collation);
return new HiveSortExchange(cluster, traitSet, input, distribution, collation, joinKeys);
}
use of org.apache.calcite.plan.RelTraitSet in project hive by apache.
the class HiveSortLimit method create.
/**
* Creates a HiveSortLimit.
*
* @param input Input relational expression
* @param collation array of sort specifications
* @param offset Expression for number of rows to discard before returning
* first row
* @param fetch Expression for number of rows to fetch
*/
public static HiveSortLimit create(RelNode input, RelCollation collation, RexNode offset, RexNode fetch) {
RelOptCluster cluster = input.getCluster();
collation = RelCollationTraitDef.INSTANCE.canonize(collation);
RelTraitSet traitSet = TraitsUtil.getSortTraitSet(cluster, input.getTraitSet(), collation);
return new HiveSortLimit(cluster, traitSet, input, collation, offset, fetch);
}
use of org.apache.calcite.plan.RelTraitSet in project drill by apache.
the class DirPrunedEnumerableTableScan method create.
/** Creates an DirPrunedEnumerableTableScan. */
public static EnumerableTableScan create(RelOptCluster cluster, RelOptTable relOptTable, String digestFromSelection) {
final Table table = relOptTable.unwrap(Table.class);
Class elementType = EnumerableTableScan.deduceElementType(table);
final RelTraitSet traitSet = cluster.traitSetOf(EnumerableConvention.INSTANCE).replaceIfs(RelCollationTraitDef.INSTANCE, new Supplier<List<RelCollation>>() {
public List<RelCollation> get() {
if (table != null) {
return table.getStatistic().getCollations();
}
return ImmutableList.of();
}
});
return new DirPrunedEnumerableTableScan(cluster, traitSet, relOptTable, elementType, digestFromSelection);
}
use of org.apache.calcite.plan.RelTraitSet in project drill by apache.
the class DrillLimitRule method onMatch.
@Override
public void onMatch(RelOptRuleCall call) {
final Sort incomingSort = call.rel(0);
final RelTraitSet incomingTraits = incomingSort.getTraitSet();
RelNode input = incomingSort.getInput();
// limit information.
if (!incomingSort.getCollation().getFieldCollations().isEmpty()) {
input = incomingSort.copy(incomingTraits, input, incomingSort.getCollation(), null, null);
}
RelNode convertedInput = convert(input, input.getTraitSet().plus(DrillRel.DRILL_LOGICAL));
call.transformTo(new DrillLimitRel(incomingSort.getCluster(), convertedInput.getTraitSet().plus(DrillRel.DRILL_LOGICAL), convertedInput, incomingSort.offset, incomingSort.fetch));
}
Aggregations