Fixing setting flow->hashExpr plan references
When flow->hashExpr is created, we ignore the relable node while checking the existence of the expression in the targetlist, if a match is not found in the targetlist, hashExpr is added to the targetlist with resjunk=true. In create_join_plan ``` /** * If plan has a flow node, ensure all entries of hashExpr * are in the targetlist. */ if (plan->flow && plan->flow->hashExpr) { plan->targetlist = add_to_flat_tlist(plan->targetlist, plan->flow->hashExpr, true /* resjunk */ ); } ``` add_to_flat_tlist uses tlist_member_ignore_relabel Later, in set_plan_refs, the references of the vars are updated. This commit ensures that the contract of ignoring the relable node is held while trying to update the references in hashExpr. Prior to this commit, in set_plan_refs while checking the existing of hashExpr in targetlist relable node were not ignored which resulted in not finding the coressponding projection element and the planning used to fail with ERROR: variable not found in subplan target list fix_upper_expr ensures that the cast/type of the variable in the upper plan node is not ignore, thus it considered a plain match for non vars expression. Thus, added a new method to perform special handling of flow->hashExpr as they have to be matched with the target list at the same level (not of the child). This has been a bug in 5 and previous version of greenplum since long, this is a greenplum specific fix, so may be was never caught.
Showing
想要评论请 注册 或 登录