This is an automated email from the ASF dual-hosted git repository. dlych pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/asterixdb.git
commit bc63ab5aa8d03247df6bff3523b26e3e314aa97f Author: Dmitry Lychagin <[email protected]> AuthorDate: Thu Jan 14 18:04:52 2021 -0800 [NO ISSUE][COMP] Fix assign's explicit ordering handling - user model changes: no - storage format changes: no - interface changes: no Details: - Fix handling of assign's explicit ordering property by SubstituteVariableVisitor Change-Id: I41e621be42d0590ff808ddf1abf94cb2962ca722 Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/9606 Integration-Tests: Jenkins <[email protected]> Tested-by: Jenkins <[email protected]> Reviewed-by: Dmitry Lychagin <[email protected]> Reviewed-by: Ali Alsuliman <[email protected]> --- .../logical/visitors/SubstituteVariableVisitor.java | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/visitors/SubstituteVariableVisitor.java b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/visitors/SubstituteVariableVisitor.java index d1a1c03..a2107e5 100644 --- a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/visitors/SubstituteVariableVisitor.java +++ b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/visitors/SubstituteVariableVisitor.java @@ -18,6 +18,7 @@ */ package org.apache.hyracks.algebricks.core.algebra.operators.logical.visitors; +import java.util.ArrayList; import java.util.List; import org.apache.commons.lang3.mutable.Mutable; @@ -69,6 +70,7 @@ import org.apache.hyracks.algebricks.core.algebra.operators.logical.UnnestOperat import org.apache.hyracks.algebricks.core.algebra.operators.logical.WindowOperator; import org.apache.hyracks.algebricks.core.algebra.operators.logical.WriteOperator; import org.apache.hyracks.algebricks.core.algebra.operators.logical.WriteResultOperator; +import org.apache.hyracks.algebricks.core.algebra.properties.LocalOrderProperty; import org.apache.hyracks.algebricks.core.algebra.properties.OrderColumn; import org.apache.hyracks.algebricks.core.algebra.typing.ITypingContext; import org.apache.hyracks.algebricks.core.algebra.visitors.ILogicalOperatorVisitor; @@ -103,18 +105,19 @@ public class SubstituteVariableVisitor boolean producedVarFound = substAssignVariables(op.getVariables(), op.getExpressions(), pair.first, pair.second); if (producedVarFound) { - substProducedVarInTypeEnvironment(op, pair); - } else { // Substitute variables stored in ordering property if (op.getExplicitOrderingProperty() != null) { List<OrderColumn> orderColumns = op.getExplicitOrderingProperty().getOrderColumns(); - for (int i = 0; i < orderColumns.size(); i++) { - OrderColumn oc = orderColumns.get(i); - if (oc.getColumn().equals(pair.first)) { - orderColumns.set(i, new OrderColumn(pair.second, oc.getOrder())); - } + List<OrderColumn> newOrderColumns = new ArrayList<>(orderColumns.size()); + for (OrderColumn oc : orderColumns) { + LogicalVariable columnVar = oc.getColumn(); + LogicalVariable newColumnVar = columnVar.equals(pair.first) ? pair.second : columnVar; + newOrderColumns.add(new OrderColumn(newColumnVar, oc.getOrder())); } + op.setExplicitOrderingProperty(new LocalOrderProperty(newOrderColumns)); } + + substProducedVarInTypeEnvironment(op, pair); } return null; }
