@@ -1960,107 +1960,3 @@ contains_outer_params(Node *node, void *context)
19601960 }
19611961 return expression_tree_walker (node , contains_outer_params , context );
19621962}
1963-
1964- typedef struct CTEMotionSearchContext
1965- {
1966- plan_tree_base_prefix base ; /* Required prefix for plan_tree_walker/mutator */
1967- bool bellowMotion ; /* True if we are under a Motion node */
1968- } CTEMotionSearchContext ;
1969-
1970- /*
1971- * We can not pass params by a motion.
1972- * So there should not be any motion between RecursiveUnion and WorkTableScan.
1973- * Check if there is a motion between RecursiveUnion and WorkTableScan.
1974- */
1975- static bool
1976- cte_motion_search_walker (Node * node , CTEMotionSearchContext * context )
1977- {
1978- if (node == NULL )
1979- return false;
1980-
1981- if (IsA (node , Motion ))
1982- {
1983- bool savedBellowMotion = context -> bellowMotion ;
1984- context -> bellowMotion = true;
1985- plan_tree_walker (node , cte_motion_search_walker , context , true);
1986- context -> bellowMotion = savedBellowMotion ;
1987- return false;
1988- }
1989- if (IsA (node , RecursiveUnion ))
1990- {
1991- /*
1992- * We process RecursiveUnion recursively in create_recursiveunion_plan
1993- * here, we do not process repeatedly.
1994- */
1995- return false;
1996- }
1997- if (IsA (node , WorkTableScan ))
1998- {
1999- if (context -> bellowMotion )
2000- {
2001- elog (ERROR , "Passing parameters across motion is not supported." );
2002- }
2003- return false;
2004- }
2005- return plan_tree_walker (node , cte_motion_search_walker , context , true);
2006- }
2007-
2008- /*
2009- * GPDB does not support pass params by a motion.
2010- * Check the rightplan of RecursiveUnion, wether there is a motion above WorkTableScan,
2011- * If true, throw an error.
2012- */
2013- void
2014- checkMotionAboveWorkTableScan (Node * node , PlannerInfo * root )
2015- {
2016- CTEMotionSearchContext context ;
2017- planner_init_plan_tree_base (& context .base , root );
2018- context .bellowMotion = false;
2019-
2020- (void ) cte_motion_search_walker (node , (void * ) & context );
2021- }
2022-
2023- typedef struct MotionWithParamContext
2024- {
2025- plan_tree_base_prefix base ; /* Required prefix for plan_tree_walker/mutator */
2026- Bitmapset * nestLoopParams ; /* nestloop params */
2027- } MotionWithParamContext ;
2028-
2029- /*
2030- * check whether pass params by a motion
2031- */
2032- static bool
2033- checkMotionWithParamWalker (Node * node , MotionWithParamContext * motionWithParamcontext )
2034- {
2035- if (node == NULL )
2036- return false;
2037-
2038- if (IsA (node , Motion ))
2039- {
2040- Plan * plan = (Plan * ) node ;
2041- Bitmapset * finalExtParam ;
2042- if (!bms_is_empty (plan -> extParam ))
2043- {
2044- finalExtParam = bms_intersect (plan -> extParam , motionWithParamcontext -> nestLoopParams );
2045- if (!bms_is_empty (finalExtParam ))
2046- {
2047- elog (ERROR , "Passing parameters across motion is not supported." );
2048- }
2049- }
2050- }
2051-
2052- return plan_tree_walker (node , checkMotionWithParamWalker , motionWithParamcontext , true);
2053- }
2054-
2055- /*
2056- * We can not deliver a param by a motion node.
2057- * If there is a param on motion node, we should throw an error.
2058- */
2059- void
2060- checkMotionWithParam (Node * node , Bitmapset * bmsNestParams , PlannerInfo * root )
2061- {
2062- MotionWithParamContext motionWithParamcontext ;
2063- motionWithParamcontext .nestLoopParams = bmsNestParams ;
2064- planner_init_plan_tree_base (& motionWithParamcontext .base , root );
2065- checkMotionWithParamWalker (node , & motionWithParamcontext );
2066- }
0 commit comments