@@ -920,41 +920,43 @@ private static List<RewriteJob> getWholeTreeRewriteJobs(
920920 custom (RuleType .DISTINCT_AGG_STRATEGY_SELECTOR ,
921921 () -> DistinctAggStrategySelector .INSTANCE ))));
922922
923- // Rewrite search function before VariantSubPathPruning
924- // so that ElementAt expressions from search can be processed
925- rewriteJobs .addAll (jobs (
926- bottomUp (new RewriteSearchToSlots ())
927- ));
923+ // Rewrite search function before VariantSubPathPruning
924+ // so that ElementAt expressions from search can be processed
925+ rewriteJobs .addAll (jobs (
926+ bottomUp (new RewriteSearchToSlots ())
927+ ));
928928
929- if (needSubPathPushDown ) {
929+ if (needSubPathPushDown ) {
930+ rewriteJobs .addAll (jobs (
931+ topic ("variant element_at push down" ,
932+ custom (RuleType .VARIANT_SUB_PATH_PRUNING , VariantSubPathPruning ::new )
933+ )
934+ ));
935+ }
936+ rewriteJobs .add (
937+ topic ("nested column prune" ,
938+ custom (RuleType .NESTED_COLUMN_PRUNING , NestedColumnPruning ::new )
939+ )
940+ );
930941 rewriteJobs .addAll (jobs (
931- topic ("variant element_at push down" ,
932- custom (RuleType .VARIANT_SUB_PATH_PRUNING , VariantSubPathPruning ::new )
942+ topic ("rewrite cte sub-tree after sub path push down" ,
943+ custom (RuleType .CLEAR_CONTEXT_STATUS , ClearContextStatus ::new ),
944+ custom (RuleType .REWRITE_CTE_CHILDREN ,
945+ () -> new RewriteCteChildren (afterPushDownJobs , runCboRules )
946+ )
947+ ),
948+ topic ("whole plan check" ,
949+ custom (RuleType .ADJUST_NULLABLE , () -> new AdjustNullable (false ))
950+ ),
951+ // NullableDependentExpressionRewrite need to be done after nullable fixed
952+ topic ("condition function" , bottomUp (ImmutableList .of (
953+ new NullableDependentExpressionRewrite ())))
933954 )
934- ));
955+ );
956+ return rewriteJobs ;
935957 }
936- rewriteJobs .add (
937- topic ("nested column prune" ,
938- custom (RuleType .NESTED_COLUMN_PRUNING , NestedColumnPruning ::new )
939- )
940- );
941- rewriteJobs .addAll (jobs (
942- topic ("rewrite cte sub-tree after sub path push down" ,
943- custom (RuleType .CLEAR_CONTEXT_STATUS , ClearContextStatus ::new ),
944- custom (RuleType .REWRITE_CTE_CHILDREN ,
945- () -> new RewriteCteChildren (afterPushDownJobs , runCboRules )
946- )
947- ),
948- topic ("whole plan check" ,
949- custom (RuleType .ADJUST_NULLABLE , () -> new AdjustNullable (false ))
950- ),
951- // NullableDependentExpressionRewrite need to be done after nullable fixed
952- topic ("condition function" , bottomUp (ImmutableList .of (
953- new NullableDependentExpressionRewrite ())))
954- ));
955- return rewriteJobs ;
956- }
957- );
958+ ));
959+ return builder .build ();
958960 }
959961
960962 @ Override
0 commit comments