// implement RelNode public RelOptCost computeSelfCost(RelOptPlanner planner) { double dRows = RelMetadataQuery.getRowCount(this); // Assume CPU is negligible since values are precomputed. double dCpu = 1; double dIo = 0; return planner.makeCost(dRows, dCpu, dIo); }
public RelTraitSet traitSetOf(RelTrait... traits) { RelTraitSet traitSet = emptyTraitSet; assert traitSet.size() == planner.getRelTraitDefs().size(); for (RelTrait trait : traits) { traitSet = traitSet.replace(trait); } return traitSet; }
/** Creates a cluster. */ RelOptCluster( RelOptQuery query, RelOptPlanner planner, RelDataTypeFactory typeFactory, RexBuilder rexBuilder) { assert planner != null; assert typeFactory != null; this.query = query; this.planner = planner; this.typeFactory = typeFactory; this.rexBuilder = rexBuilder; this.originalExpression = rexBuilder.makeLiteral("?"); // set up a default rel metadata provider, // giving the planner first crack at everything metadataProvider = new DefaultRelMetadataProvider(); this.emptyTraitSet = planner.emptyTraitSet(); }
public RelOptCost computeSelfCost(RelOptPlanner planner) { double dRows = RelMetadataQuery.getRowCount(this); double dCpu = RelMetadataQuery.getRowCount(getChild()) * program.getExprCount(); double dIo = 0; return planner.makeCost(dRows, dCpu, dIo); }