@Override public void onMatch(RelOptRuleCall call) { final Project project = call.rel(0); final RelMetadataQuery mq = call.getMetadataQuery(); final RelOptPredicateList predicates = mq.getPulledUpPredicates(project.getInput()); final List<RexNode> expList = Lists.newArrayList(project.getProjects()); if (reduceExpressions(project, expList, predicates, false, matchNullability)) { call.transformTo( call.builder() .push(project.getInput()) .project(expList, project.getRowType().getFieldNames()) .build()); // New plan is absolutely better than old plan. call.getPlanner().setImportance(project, 0.0); } } }
@Override public void onMatch(RelOptRuleCall call) { final Project project = call.rel(0); final RelMetadataQuery mq = call.getMetadataQuery(); final RelOptPredicateList predicates = mq.getPulledUpPredicates(project.getInput()); final List<RexNode> expList = Lists.newArrayList(project.getProjects()); if (reduceExpressions(project, expList, predicates, false, matchNullability)) { call.transformTo( call.builder() .push(project.getInput()) .project(expList, project.getRowType().getFieldNames()) .build()); // New plan is absolutely better than old plan. call.getPlanner().setImportance(project, 0.0); } } }
/** Test case that reduces a nullable expression to a NOT NULL literal. */ @Test public void testReduceNullableToNotNull2() throws Exception { final ReduceExpressionsRule.ProjectReduceExpressionsRule rule = new ReduceExpressionsRule.ProjectReduceExpressionsRule( LogicalProject.class, false, RelFactories.LOGICAL_BUILDER); checkReduceNullableToNotNull(rule); }
/** Test case that reduces a nullable expression to a NOT NULL literal. */ @Test public void testReduceNullableToNotNull2() throws Exception { final ReduceExpressionsRule.ProjectReduceExpressionsRule rule = new ReduceExpressionsRule.ProjectReduceExpressionsRule( LogicalProject.class, false, RelFactories.LOGICAL_BUILDER); checkReduceNullableToNotNull(rule); }