@@ -454,11 +454,10 @@ crate::plan_to_language! {
454454 members: Vec <LogicalPlan >,
455455 alias_to_cube: Vec <( String , String ) >,
456456 } ,
457- WrapperPushdownReplacer {
458- member: Arc <LogicalPlan >,
457+ WrapperReplacerContext {
459458 alias_to_cube: Vec <( String , String ) >,
460- // This means that result of this replacer would be used as member expression in load query to Cube.
461- // This flag should be passed from top, by the rule that starts wrapping new logical plan node.
459+ // When `member` is expression this means that result of this replacer should be used as member expression in load query to Cube.
460+ // When `member` is logical plan node this means that logical plan inside allows to push to Cube
462461 // Important caveat: it means that result would be used for push to cube *and only there*.
463462 // So it's more like "must push to Cube" than "can push to Cube"
464463 // This part is important for rewrites like SUM(sumMeasure) => sumMeasure
@@ -471,23 +470,19 @@ crate::plan_to_language! {
471470 // Used to allow to rewrite columns from them even with push to Cube enabled
472471 grouped_subqueries: Vec <String >,
473472 } ,
473+ WrapperPushdownReplacer {
474+ member: Arc <LogicalPlan >,
475+ // Only WrapperReplacerContext should be allowed here
476+ // Context be passed from top, by the rule that starts wrapping new logical plan node,
477+ // and should make roundtrip from top to bottom and back.
478+ context: Arc <LogicalPlan >,
479+ } ,
474480 WrapperPullupReplacer {
475481 member: Arc <LogicalPlan >,
476- alias_to_cube: Vec <( String , String ) >,
477- // When `member` is expression this means that result of this replacer should be used as member expression in load query to Cube.
478- // When `member` is logical plan node this means that logical plan inside allows to push to Cube
479- // This flag should make roundtrip from top to bottom and back.
480- // Important caveat: it means that result should be used for push to cube *and only there*.
481- // So it's more like "must push to Cube" than "can push to Cube"
482- // This part is important for rewrites like SUM(sumMeasure) => sumMeasure
483- // We can use sumMeasure instead of SUM(sumMeasure) ONLY in with push to Cube
484- // An vice versa, we can't use SUM(sumMeasure) in grouped query to Cube, so it can be allowed ONLY without push to grouped Cube query
485- push_to_cube: bool ,
486- in_projection: bool ,
487- cube_members: Vec <LogicalPlan >,
488- // Known qualifiers of grouped subqueries
489- // Used to allow to rewrite columns from them even with push to Cube enabled
490- grouped_subqueries: Vec <String >,
482+ // Only WrapperReplacerContext should be allowed here
483+ // Context be passed from top, by the rule that starts wrapping new logical plan node,
484+ // and should make roundtrip from top to bottom and back.
485+ context: Arc <LogicalPlan >,
491486 } ,
492487 FlattenPushdownReplacer {
493488 expr: Arc <Expr >,
@@ -1973,30 +1968,24 @@ fn case_expr_replacer(members: impl Display, alias_to_cube: impl Display) -> Str
19731968 format ! ( "(CaseExprReplacer {} {})" , members, alias_to_cube)
19741969}
19751970
1976- fn wrapper_pushdown_replacer (
1977- members : impl Display ,
1971+ fn wrapper_replacer_context (
19781972 alias_to_cube : impl Display ,
19791973 push_to_cube : impl Display ,
19801974 in_projection : impl Display ,
19811975 cube_members : impl Display ,
19821976 grouped_subqueries : impl Display ,
19831977) -> String {
19841978 format ! (
1985- "(WrapperPushdownReplacer {members} {alias_to_cube} {push_to_cube} {in_projection} {cube_members} {grouped_subqueries})" ,
1979+ "(WrapperReplacerContext {alias_to_cube} {push_to_cube} {in_projection} {cube_members} {grouped_subqueries})" ,
19861980 )
19871981}
19881982
1989- fn wrapper_pullup_replacer (
1990- members : impl Display ,
1991- alias_to_cube : impl Display ,
1992- push_to_cube : impl Display ,
1993- in_projection : impl Display ,
1994- cube_members : impl Display ,
1995- grouped_subqueries : impl Display ,
1996- ) -> String {
1997- format ! (
1998- "(WrapperPullupReplacer {members} {alias_to_cube} {push_to_cube} {in_projection} {cube_members} {grouped_subqueries})" ,
1999- )
1983+ fn wrapper_pushdown_replacer ( members : impl Display , context : impl Display ) -> String {
1984+ format ! ( "(WrapperPushdownReplacer {members} {context})" , )
1985+ }
1986+
1987+ fn wrapper_pullup_replacer ( members : impl Display , context : impl Display ) -> String {
1988+ format ! ( "(WrapperPullupReplacer {members} {context})" , )
20001989}
20011990
20021991fn flatten_pushdown_replacer (
0 commit comments