>From Preetham Poluparthi <[email protected]>: Preetham Poluparthi has submitted this change. ( https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/20426?usp=email )
Change subject: [ASTERIXDB-3648][COMP] Fix incorrect replacement of Left Outer Joins with Unnest in CBO ...................................................................... [ASTERIXDB-3648][COMP] Fix incorrect replacement of Left Outer Joins with Unnest in CBO - user model changes: no - storage format changes: no - interface changes: no Ext-ref: MB-68691 Change-Id: I3f1d4d093cf1bd23f5db75fce569fd174e8cedb4 Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/20426 Integration-Tests: Jenkins <[email protected]> Reviewed-by: Preetham Poluparthi <[email protected]> Reviewed-by: <[email protected]> Tested-by: Preetham Poluparthi <[email protected]> --- M asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/cbo/EnumerateJoinsRule.java 1 file changed, 8 insertions(+), 6 deletions(-) Approvals: Preetham Poluparthi: Looks good to me, approved; Verified [email protected]: Looks good to me, but someone else must approve Jenkins: Verified Anon. E. Moose #1000171: diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/cbo/EnumerateJoinsRule.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/cbo/EnumerateJoinsRule.java index 8406520..b9b35c2 100644 --- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/cbo/EnumerateJoinsRule.java +++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/cbo/EnumerateJoinsRule.java @@ -308,7 +308,7 @@ modifyUnnestInfo = new ArrayList<>(); collectUnnestModificationInfo(null, root, cheapestPlanNode); for (int k = 0; k < modifyUnnestInfo.size(); k++) { - modifyTree(null, root, k); + modifyTree(null, 0, root, k); if (newRootAfterUnnest != null) { root = newRootAfterUnnest; } @@ -384,7 +384,7 @@ return false; } - private void modifyTree(ILogicalOperator parent, ILogicalOperator op, int k) { + private void modifyTree(ILogicalOperator parent, int index, ILogicalOperator op, int k) { if (modifyUnnestInfo.get(k).second == op) { // found the one to get rid off; this should be an OJ int size = modifyUnnestInfo.get(k).third.size(); UnnestOperator uOp = (UnnestOperator) modifyUnnestInfo.get(k).third.get(size - 1); // UnnestOp is always at the end @@ -394,20 +394,22 @@ ILogicalOperator q = newRootAfterUnnest; if (modifyUnnestInfo.get(k).third.size() > 1) { for (ILogicalOperator p : modifyUnnestInfo.get(k).third) { - q.getInputs().get(0).setValue(p); + q.getInputs().get(index).setValue(p); q = p; } } } else { ILogicalOperator q = parent; for (ILogicalOperator p : modifyUnnestInfo.get(k).third) { - q.getInputs().get(0).setValue(p); + q.getInputs().get(index).setValue(p); q = p; } } } - for (Mutable<ILogicalOperator> input : op.getInputs()) { - modifyTree(op, input.getValue(), k); + int size = op.getInputs().size(); + for (int i = 0; i < size; i++) { + Mutable<ILogicalOperator> input = op.getInputs().get(i); + modifyTree(op, i, input.getValue(), k); } } -- To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/20426?usp=email To unsubscribe, or for help writing mail filters, visit https://asterix-gerrit.ics.uci.edu/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: asterixdb Gerrit-Branch: phoenix Gerrit-Change-Id: I3f1d4d093cf1bd23f5db75fce569fd174e8cedb4 Gerrit-Change-Number: 20426 Gerrit-PatchSet: 5 Gerrit-Owner: Preetham Poluparthi <[email protected]> Gerrit-Reviewer: Anon. E. Moose #1000171 Gerrit-Reviewer: Jenkins <[email protected]> Gerrit-Reviewer: Preetham Poluparthi <[email protected]> Gerrit-Reviewer: [email protected]
