forked from greenplum-db/gpdb-archive
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix orca preprocess step for query with Select-Project-NaryJoin patte…
…rn (#17423) Issue: When a query having pattern of Select-Project-NaryJoin with Select predicate's condition also containing pattern ScalarSubquery-Project-Select-Project-NaryJoin is executed, a crash was happening. RCA: During the preprocessing step `PexprTransposeSelectAndProject`, function `CollapseSelectAndReplaceColref` is called on the expr with the pattern and Project expr inside the Select's predicate is being dropped, but it's column references are not being replaced with equivalent dropped project expr. That is because `CollapseSelectAndReplaceColref` is called recursively on the Select's predicate. That function only takes care of removing project but doesn't re-add the project expr on top of collapsed select. Fix: Now function `CollapseSelectAndReplaceColref` is removed. For creation of collapsed select, * First colrefs of the columns projected in the project list are replaced with their equivalent Project exprs in the Select's predicate expr. This happens in the refactored function `CUtils::ReplaceColrefWithProjectExpr` * Then the new Select predicate with replaced colrefs and the NaryJoin expr are transposed recursively with `PexprTransposeSelectAndProject`. * Collapsed Select is created using the transposed NaryJoin and transposed Select predicate. Collapsed Select is then added as a child to the CLogicalProject creating the new transposed expr. Input: +--CLogicalSelect |--CLogicalProject | +--CLogicalNAryJoin +--... +--CLogicalSelect +--CLogicalProject +--CLogicalNAryJoin Old Output: +--CLogicalProject |--CLogicalSelect | +--CLogicalNAryJoin +--... +--CLogicalSelect +--CLogicalNAryJoin Fixed output: +--CLogicalProject |--CLogicalSelect | +--CLogicalNAryJoin +--... +--CLogicalProject +--CLogicalSelect +--CLogicalNAryJoin * New regression testcases are added that tests queries containing the above pattern. * New mdp testcase is added that tests a query with above pattern.
- Loading branch information
Showing
9 changed files
with
1,353 additions
and
79 deletions.
There are no files selected for viewing
1,028 changes: 1,028 additions & 0 deletions
1,028
...gporca/data/dxl/minidump/JoinOnViewWithCastedColumnAndJoinWithCastedColumnInPredicate.mdp
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.