private LogicalExpression materializePruneExpr(LogicalExpression pruneCondition, PlannerSettings settings, RelNode scanRel, VectorContainer container) { // materialize the expression container.buildSchema(); return ExpressionTreeMaterializer.materializeAndCheckErrors(pruneCondition, container.getSchema(), optimizerContext.getFunctionRegistry()); }
@Override public Set<RelOptRule> getRules(OptimizerRulesContext optimizerContext, PlannerPhase phase, SourceType pluginType) { final OptionManager options = optimizerContext.getPlannerSettings().getOptions(); switch(phase){ case LOGICAL: return ImmutableSet.<RelOptRule>of(new ElasticScanRule(pluginType)); case PHYSICAL: ImmutableSet.Builder<RelOptRule> builder = ImmutableSet.builder(); builder.add(new ElasticScanPrule(optimizerContext.getFunctionRegistry())); if (options.getOption(ExecConstants.ELASTIC_RULES_PROJECT)) { builder.add(new ElasticProjectRule(optimizerContext.getFunctionRegistry())); } if (options.getOption(ExecConstants.ELASTIC_RULES_FILTER)) { builder.add(ElasticFilterRule.INSTANCE); } if (options.getOption(ExecConstants.ELASTIC_RULES_LIMIT)) { builder.add(ElasticLimitRule.INSTANCE); } if (options.getOption(ExecConstants.ELASTIC_RULES_SAMPLE)) { builder.add(ElasticSampleRule.INSTANCE); } return builder.build(); default: return ImmutableSet.of(); } }