This is an automated email from the ASF dual-hosted git repository.

alsuliman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/asterixdb.git


The following commit(s) were added to refs/heads/master by this push:
     new 2dff04c  [ASTERIXDB-2647][COMP] Random partitioner shouldn't preserve 
input's properties
2dff04c is described below

commit 2dff04c9fb460bde6c2df723054a617272d1062d
Author: Ali Alsuliman <[email protected]>
AuthorDate: Wed Sep 25 11:31:11 2019 -0700

    [ASTERIXDB-2647][COMP] Random partitioner shouldn't preserve input's 
properties
    
    - user model changes: no
    - storage format changes: no
    - interface changes: no
    
    Details:
    Random partitioner operator currently always propagates
    the local properties of its input. If the data of the
    input operator is partitioned, the random partitioner
    should not propagate the local properties of the input
    since the random partitioner destroys them.
    
    Change-Id: I0378597451b3e6b25e8b45295159efec262abae2
    Reviewed-on: https://asterix-gerrit.ics.uci.edu/3575
    Integration-Tests: Jenkins <[email protected]>
    Contrib: Jenkins <[email protected]>
    Tested-by: Jenkins <[email protected]>
    Reviewed-by: Ali Alsuliman <[email protected]>
    Reviewed-by: Dmitry Lychagin <[email protected]>
---
 .../physical/RandomPartitionExchangePOperator.java | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git 
a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/physical/RandomPartitionExchangePOperator.java
 
b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/physical/RandomPartitionExchangePOperator.java
index d17c0d9..844d2ec 100644
--- 
a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/physical/RandomPartitionExchangePOperator.java
+++ 
b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/physical/RandomPartitionExchangePOperator.java
@@ -18,6 +18,11 @@
  */
 package org.apache.hyracks.algebricks.core.algebra.operators.physical;
 
+import static 
org.apache.hyracks.algebricks.core.algebra.properties.IPartitioningProperty.PartitioningType;
+
+import java.util.Collections;
+import java.util.List;
+
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.common.utils.Pair;
 import org.apache.hyracks.algebricks.core.algebra.base.IHyracksJobBuilder;
@@ -27,7 +32,9 @@ import 
org.apache.hyracks.algebricks.core.algebra.base.IOptimizationContext;
 import org.apache.hyracks.algebricks.core.algebra.base.PhysicalOperatorTag;
 import 
org.apache.hyracks.algebricks.core.algebra.operators.logical.AbstractLogicalOperator;
 import 
org.apache.hyracks.algebricks.core.algebra.operators.logical.IOperatorSchema;
+import 
org.apache.hyracks.algebricks.core.algebra.properties.ILocalStructuralProperty;
 import org.apache.hyracks.algebricks.core.algebra.properties.INodeDomain;
+import 
org.apache.hyracks.algebricks.core.algebra.properties.IPartitioningProperty;
 import 
org.apache.hyracks.algebricks.core.algebra.properties.IPhysicalPropertiesVector;
 import 
org.apache.hyracks.algebricks.core.algebra.properties.PhysicalRequirements;
 import 
org.apache.hyracks.algebricks.core.algebra.properties.RandomPartitioningProperty;
@@ -68,7 +75,7 @@ public class RandomPartitionExchangePOperator extends 
AbstractExchangePOperator
             ILogicalOperator op, IOperatorSchema opSchema, JobGenContext 
context) throws AlgebricksException {
         ITuplePartitionComputerFactory tpcf = new 
RandomPartitionComputerFactory();
         MToNPartitioningConnectorDescriptor conn = new 
MToNPartitioningConnectorDescriptor(spec, tpcf);
-        return new Pair<IConnectorDescriptor, TargetConstraint>(conn, null);
+        return new Pair<>(conn, null);
     }
 
     @Override
@@ -79,8 +86,16 @@ public class RandomPartitionExchangePOperator extends 
AbstractExchangePOperator
     @Override
     public void computeDeliveredProperties(ILogicalOperator op, 
IOptimizationContext context) {
         AbstractLogicalOperator op2 = (AbstractLogicalOperator) 
op.getInputs().get(0).getValue();
-        this.deliveredProperties = new StructuralPropertiesVector(new 
RandomPartitioningProperty(domain),
-                op2.getDeliveredPhysicalProperties().getLocalProperties());
+        IPhysicalPropertiesVector childDeliveredProps = 
op2.getDeliveredPhysicalProperties();
+        IPartitioningProperty childPartitioning = 
childDeliveredProps.getPartitioningProperty();
+        List<ILocalStructuralProperty> localProps;
+        // local properties of child is preserved if child is unpartitioned. 
Otherwise, local props are destroyed.
+        if (childPartitioning != null && 
childPartitioning.getPartitioningType() == PartitioningType.UNPARTITIONED) {
+            localProps = childDeliveredProps.getLocalProperties();
+        } else {
+            localProps = Collections.emptyList();
+        }
+        this.deliveredProperties = new StructuralPropertiesVector(new 
RandomPartitioningProperty(domain), localProps);
     }
 
     @Override
@@ -88,5 +103,4 @@ public class RandomPartitionExchangePOperator extends 
AbstractExchangePOperator
             IPhysicalPropertiesVector reqdByParent, IOptimizationContext 
context) {
         return emptyUnaryRequirements();
     }
-
 }

Reply via email to