/** Creates a query planner and initializes it with a default set of
* rules. */
protected RelOptPlanner createPlanner(OptiqPrepare.Context prepareContext,
org.eigenbase.relopt.Context externalContext,
RelOptCostFactory costFactory) {
final VolcanoPlanner planner =
new VolcanoPlanner(costFactory, externalContext);
planner.addRelTraitDef(ConventionTraitDef.INSTANCE);
if (ENABLE_COLLATION_TRAIT) {
planner.addRelTraitDef(RelCollationTraitDef.INSTANCE);
planner.registerAbstractRelationalRules();
}
RelOptUtil.registerAbstractRels(planner);
for (RelOptRule rule : DEFAULT_RULES) {
planner.addRule(rule);
}
// Change the below to enable constant-reduction.
if (false) {
for (RelOptRule rule : CONSTANT_REDUCTION_RULES) {
planner.addRule(rule);
}
}
final SparkHandler spark = prepareContext.spark();
if (spark.enabled()) {