>From Glenn Galvizo <[email protected]>:

Glenn Galvizo has uploaded this change for review. ( 
https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/17436 )


Change subject: [ASTERIXDB-3145][COMP] Fix for subplan-JOIN rewrite type bug
......................................................................

[ASTERIXDB-3145][COMP] Fix for subplan-JOIN rewrite type bug

- user model changes: no
- storage format changes: no
- interface changes: no

Details:
A small change: issue was that JoinFromSubplanRewrite was incorrectly
modifying the original SELECT predicate (used for the JOIN), meaning
that we would leave the plan in an inconsistent state if we didn't
apply INLJ (for array indexes).

Change-Id: I291809ecd3867956b815f7a0f9387608055e00b8
---
M 
asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/array/JoinFromSubplanRewrite.java
1 file changed, 24 insertions(+), 5 deletions(-)



  git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb 
refs/changes/36/17436/1

diff --git 
a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/array/JoinFromSubplanRewrite.java
 
b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/array/JoinFromSubplanRewrite.java
index f4fa0fc..be53a50 100644
--- 
a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/array/JoinFromSubplanRewrite.java
+++ 
b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/array/JoinFromSubplanRewrite.java
@@ -255,9 +255,9 @@
             LogicalVariable newVar = context.newVar();
             VariableReferenceExpression newVarRef = new 
VariableReferenceExpression(newVar);
             newVarRef.setSourceLocation(joinOp.getSourceLocation());
-            AssignOperator newAssign =
-                    new AssignOperator(newVar, new 
MutableObject<>(arg.getValue().cloneExpression()));
-            newAssign.setSourceLocation(arg.getValue().getSourceLocation());
+            Mutable<ILogicalExpression> clonedArgRef = new 
MutableObject<>(arg.getValue().cloneExpression());
+            AssignOperator newAssign = new AssignOperator(newVar, 
clonedArgRef);
+            
newAssign.setSourceLocation(clonedArgRef.getValue().getSourceLocation());
             newAssign.setExecutionMode(joinOp.getExecutionMode());

             // Place the new ASSIGN in the appropriate join branch.
@@ -274,14 +274,14 @@
                 context.computeAndSetTypeEnvironmentForOperator(newAssign);
                 joinOp.getInputs().get(0).setValue(newAssign);
                 context.computeAndSetTypeEnvironmentForOperator(joinOp);
-                arg.setValue(newVarRef);
+                clonedArgRef.setValue(newVarRef);

             } else if (new 
HashSet<>(varsFromRightBranch).containsAll(usedVarsFromFunc)) {
                 newAssign.getInputs().add(new 
MutableObject<>(rightBranchRoot));
                 context.computeAndSetTypeEnvironmentForOperator(newAssign);
                 joinOp.getInputs().get(1).setValue(newAssign);
                 context.computeAndSetTypeEnvironmentForOperator(joinOp);
-                arg.setValue(newVarRef);
+                clonedArgRef.setValue(newVarRef);
 
             }
         }

--
To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/17436
To unsubscribe, or for help writing mail filters, visit 
https://asterix-gerrit.ics.uci.edu/settings

Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Change-Id: I291809ecd3867956b815f7a0f9387608055e00b8
Gerrit-Change-Number: 17436
Gerrit-PatchSet: 1
Gerrit-Owner: Glenn Galvizo <[email protected]>
Gerrit-MessageType: newchange

Reply via email to