@@ -457,11 +457,10 @@ crate::plan_to_language! {
457457 members: Vec <LogicalPlan >,
458458 alias_to_cube: Vec <( String , String ) >,
459459 } ,
460- WrapperPushdownReplacer {
461- member: Arc <LogicalPlan >,
460+ WrapperReplacerContext {
462461 alias_to_cube: Vec <( String , String ) >,
463- // This means that result of this replacer would be used as member expression in load query to Cube.
464- // This flag should be passed from top, by the rule that starts wrapping new logical plan node.
462+ // When `member` is expression this means that result of this replacer should be used as member expression in load query to Cube.
463+ // When `member` is logical plan node this means that logical plan inside allows to push to Cube
465464 // Important caveat: it means that result would be used for push to cube *and only there*.
466465 // So it's more like "must push to Cube" than "can push to Cube"
467466 // This part is important for rewrites like SUM(sumMeasure) => sumMeasure
@@ -474,23 +473,19 @@ crate::plan_to_language! {
474473 // Used to allow to rewrite columns from them even with push to Cube enabled
475474 grouped_subqueries: Vec <String >,
476475 } ,
476+ WrapperPushdownReplacer {
477+ member: Arc <LogicalPlan >,
478+ // Only WrapperReplacerContext should be allowed here
479+ // Context be passed from top, by the rule that starts wrapping new logical plan node,
480+ // and should make roundtrip from top to bottom and back.
481+ context: Arc <LogicalPlan >,
482+ } ,
477483 WrapperPullupReplacer {
478484 member: Arc <LogicalPlan >,
479- alias_to_cube: Vec <( String , String ) >,
480- // When `member` is expression this means that result of this replacer should be used as member expression in load query to Cube.
481- // When `member` is logical plan node this means that logical plan inside allows to push to Cube
482- // This flag should make roundtrip from top to bottom and back.
483- // Important caveat: it means that result should be used for push to cube *and only there*.
484- // So it's more like "must push to Cube" than "can push to Cube"
485- // This part is important for rewrites like SUM(sumMeasure) => sumMeasure
486- // We can use sumMeasure instead of SUM(sumMeasure) ONLY in with push to Cube
487- // 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
488- push_to_cube: bool ,
489- in_projection: bool ,
490- cube_members: Vec <LogicalPlan >,
491- // Known qualifiers of grouped subqueries
492- // Used to allow to rewrite columns from them even with push to Cube enabled
493- grouped_subqueries: Vec <String >,
485+ // Only WrapperReplacerContext should be allowed here
486+ // Context be passed from top, by the rule that starts wrapping new logical plan node,
487+ // and should make roundtrip from top to bottom and back.
488+ context: Arc <LogicalPlan >,
494489 } ,
495490 FlattenPushdownReplacer {
496491 expr: Arc <Expr >,
@@ -1976,30 +1971,24 @@ fn case_expr_replacer(members: impl Display, alias_to_cube: impl Display) -> Str
19761971 format ! ( "(CaseExprReplacer {} {})" , members, alias_to_cube)
19771972}
19781973
1979- fn wrapper_pushdown_replacer (
1980- members : impl Display ,
1974+ fn wrapper_replacer_context (
19811975 alias_to_cube : impl Display ,
19821976 push_to_cube : impl Display ,
19831977 in_projection : impl Display ,
19841978 cube_members : impl Display ,
19851979 grouped_subqueries : impl Display ,
19861980) -> String {
19871981 format ! (
1988- "(WrapperPushdownReplacer {members} {alias_to_cube} {push_to_cube} {in_projection} {cube_members} {grouped_subqueries})" ,
1982+ "(WrapperReplacerContext {alias_to_cube} {push_to_cube} {in_projection} {cube_members} {grouped_subqueries})" ,
19891983 )
19901984}
19911985
1992- fn wrapper_pullup_replacer (
1993- members : impl Display ,
1994- alias_to_cube : impl Display ,
1995- push_to_cube : impl Display ,
1996- in_projection : impl Display ,
1997- cube_members : impl Display ,
1998- grouped_subqueries : impl Display ,
1999- ) -> String {
2000- format ! (
2001- "(WrapperPullupReplacer {members} {alias_to_cube} {push_to_cube} {in_projection} {cube_members} {grouped_subqueries})" ,
2002- )
1986+ fn wrapper_pushdown_replacer ( members : impl Display , context : impl Display ) -> String {
1987+ format ! ( "(WrapperPushdownReplacer {members} {context})" , )
1988+ }
1989+
1990+ fn wrapper_pullup_replacer ( members : impl Display , context : impl Display ) -> String {
1991+ format ! ( "(WrapperPullupReplacer {members} {context})" , )
20031992}
20041993
20051994fn flatten_pushdown_replacer (
0 commit comments