asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ima...@apache.org
Subject [1/2] incubator-asterixdb-hyracks git commit: ASTERIXDB-1109: Fixed deletion of records from open secondary index - Changed printers for idx\dataset insert\delete operators - Fixed visiting policy for idx insert\delete operator
Date Tue, 24 Nov 2015 22:22:33 GMT
Repository: incubator-asterixdb-hyracks
Updated Branches:
  refs/heads/release-0.2.17 [created] 2378ed680


ASTERIXDB-1109: Fixed deletion of records from open secondary index
 - Changed printers for idx\dataset insert\delete operators
 - Fixed visiting policy for idx insert\delete operator

Change-Id: Ib2036d2eac4b0a0c6ac2c2e7e1bac383b11106bd
Reviewed-on: https://asterix-gerrit.ics.uci.edu/462
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Taewoo Kim <wangsaeu@gmail.com>
Reviewed-by: Yingyi Bu <buyingyi@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/commit/0980f4c7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/tree/0980f4c7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/diff/0980f4c7

Branch: refs/heads/release-0.2.17
Commit: 0980f4c7e316678bf22f5ea1dfb3021e6b683de4
Parents: d4daeb4
Author: Ildar Absalyamov <ildar.absalyamov@gmail.com>
Authored: Wed Nov 11 17:27:38 2015 -0800
Committer: Ildar Absalyamov <ildar.absalyamov@gmail.com>
Committed: Wed Nov 18 22:23:47 2015 -0800

----------------------------------------------------------------------
 .../AbstractFunctionCallExpression.java         | 21 +++++++--
 .../logical/IndexInsertDeleteOperator.java      | 14 +++++-
 .../LogicalOperatorPrettyPrintVisitor.java      | 47 +++++++++++++-------
 3 files changed, 60 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/0980f4c7/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/expressions/AbstractFunctionCallExpression.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/expressions/AbstractFunctionCallExpression.java
b/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/expressions/AbstractFunctionCallExpression.java
index bab23f1..cfdd6a5 100644
--- a/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/expressions/AbstractFunctionCallExpression.java
+++ b/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/expressions/AbstractFunctionCallExpression.java
@@ -27,7 +27,6 @@ import java.util.Map;
 
 import org.apache.commons.lang3.mutable.Mutable;
 import org.apache.commons.lang3.mutable.MutableObject;
-
 import org.apache.hyracks.algebricks.core.algebra.base.EquivalenceClass;
 import org.apache.hyracks.algebricks.core.algebra.base.ILogicalExpression;
 import org.apache.hyracks.algebricks.core.algebra.base.LogicalExpressionTag;
@@ -50,7 +49,7 @@ public abstract class AbstractFunctionCallExpression extends AbstractLogicalExpr
     final private List<Mutable<ILogicalExpression>> arguments;
     private Object[] opaqueParameters;
     private final FunctionKind kind;
-    private Map<Object, IExpressionAnnotation> annotationMap = new HashMap<Object,
IExpressionAnnotation>();
+    private final Map<Object, IExpressionAnnotation> annotationMap = new HashMap<Object,
IExpressionAnnotation>();
 
     public AbstractFunctionCallExpression(FunctionKind kind, IFunctionInfo finfo,
             List<Mutable<ILogicalExpression>> arguments) {
@@ -110,6 +109,7 @@ public abstract class AbstractFunctionCallExpression extends AbstractLogicalExpr
         return arguments;
     }
 
+    @Override
     public String toString() {
         StringBuilder sb = new StringBuilder();
         sb.append("function-call: " + finfo.getFunctionIdentifier() + ", Args:[");
@@ -124,6 +124,18 @@ public abstract class AbstractFunctionCallExpression extends AbstractLogicalExpr
             sb.append(ref.getValue());
         }
         sb.append("]");
+        if (opaqueParameters != null) {
+            sb.append(", OpaqueArgs:[");
+            first = true;
+            for (Object param : opaqueParameters) {
+                if (first) {
+                    first = false;
+                } else {
+                    sb.append(", ");
+                }
+                sb.append(param);
+            }
+        }
         return sb.toString();
     }
 
@@ -172,7 +184,8 @@ public abstract class AbstractFunctionCallExpression extends AbstractLogicalExpr
     }
 
     @Override
-    public void getConstraintsForOuterJoin(Collection<FunctionalDependency> fds, Collection<LogicalVariable>
outerVars) {
+    public void getConstraintsForOuterJoin(Collection<FunctionalDependency> fds,
+            Collection<LogicalVariable> outerVars) {
         FunctionIdentifier funId = getFunctionIdentifier();
         if (funId.equals(AlgebricksBuiltinFunctions.AND)) {
             for (Mutable<ILogicalExpression> a : arguments) {
@@ -356,4 +369,4 @@ public abstract class AbstractFunctionCallExpression extends AbstractLogicalExpr
         return true;
     }
 
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/0980f4c7/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/IndexInsertDeleteOperator.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/IndexInsertDeleteOperator.java
b/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/IndexInsertDeleteOperator.java
index e9e3b01..378b916 100644
--- a/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/IndexInsertDeleteOperator.java
+++ b/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/IndexInsertDeleteOperator.java
@@ -22,13 +22,11 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.commons.lang3.mutable.Mutable;
-
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.base.ILogicalExpression;
 import org.apache.hyracks.algebricks.core.algebra.base.LogicalOperatorTag;
 import org.apache.hyracks.algebricks.core.algebra.base.LogicalVariable;
 import org.apache.hyracks.algebricks.core.algebra.expressions.IVariableTypeEnvironment;
-import org.apache.hyracks.algebricks.core.algebra.metadata.IDataSource;
 import org.apache.hyracks.algebricks.core.algebra.metadata.IDataSourceIndex;
 import org.apache.hyracks.algebricks.core.algebra.operators.logical.InsertDeleteOperator.Kind;
 import org.apache.hyracks.algebricks.core.algebra.properties.VariablePropagationPolicy;
@@ -79,6 +77,18 @@ public class IndexInsertDeleteOperator extends AbstractLogicalOperator
{
                 b = true;
             }
         }
+        if (filterExpr != null) {
+            if (visitor.transform(filterExpr)) {
+                b = true;
+            }
+        }
+        if (additionalFilteringExpressions != null) {
+            for (int i = 0; i < additionalFilteringExpressions.size(); i++) {
+                if (visitor.transform(additionalFilteringExpressions.get(i))) {
+                    b = true;
+                }
+            }
+        }
         return b;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/0980f4c7/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/prettyprint/LogicalOperatorPrettyPrintVisitor.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/prettyprint/LogicalOperatorPrettyPrintVisitor.java
b/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/prettyprint/LogicalOperatorPrettyPrintVisitor.java
index 1404a47..8c5b35b 100644
--- a/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/prettyprint/LogicalOperatorPrettyPrintVisitor.java
+++ b/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/prettyprint/LogicalOperatorPrettyPrintVisitor.java
@@ -21,7 +21,6 @@ package org.apache.hyracks.algebricks.core.algebra.prettyprint;
 import java.util.List;
 
 import org.apache.commons.lang3.mutable.Mutable;
-
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.common.utils.Pair;
 import org.apache.hyracks.algebricks.common.utils.Triple;
@@ -86,7 +85,8 @@ public class LogicalOperatorPrettyPrintVisitor implements ILogicalOperatorVisito
     }
 
     @Override
-    public String visitRunningAggregateOperator(RunningAggregateOperator op, Integer indent)
throws AlgebricksException {
+    public String visitRunningAggregateOperator(RunningAggregateOperator op, Integer indent)
+            throws AlgebricksException {
         StringBuilder buffer = new StringBuilder();
         addIndent(buffer, indent).append("running-aggregate ").append(op.getVariables()).append("
<- ");
         pprintExprList(op.getExpressions(), buffer, indent);
@@ -185,7 +185,8 @@ public class LogicalOperatorPrettyPrintVisitor implements ILogicalOperatorVisito
     }
 
     @Override
-    public String visitDistributeResultOperator(DistributeResultOperator op, Integer indent)
throws AlgebricksException {
+    public String visitDistributeResultOperator(DistributeResultOperator op, Integer indent)
+            throws AlgebricksException {
         StringBuilder buffer = new StringBuilder();
         addIndent(buffer, indent).append("distribute result ");
         pprintExprList(op.getExpressions(), buffer, indent);
@@ -258,9 +259,8 @@ public class LogicalOperatorPrettyPrintVisitor implements ILogicalOperatorVisito
     @Override
     public String visitUnnestMapOperator(UnnestMapOperator op, Integer indent) throws AlgebricksException
{
         StringBuilder buffer = new StringBuilder();
-        addIndent(buffer, indent).append(
-                "unnest-map " + op.getVariables() + " <- "
-                        + op.getExpressionRef().getValue().accept(exprVisitor, indent));
+        addIndent(buffer, indent).append("unnest-map " + op.getVariables() + " <- "
+                + op.getExpressionRef().getValue().accept(exprVisitor, indent));
         return buffer.toString();
     }
 
@@ -293,8 +293,8 @@ public class LogicalOperatorPrettyPrintVisitor implements ILogicalOperatorVisito
     @Override
     public String visitScriptOperator(ScriptOperator op, Integer indent) {
         StringBuilder buffer = new StringBuilder();
-        addIndent(buffer, indent).append(
-                "script (in: " + op.getInputVariables() + ") (out: " + op.getOutputVariables()
+ ")");
+        addIndent(buffer, indent)
+                .append("script (in: " + op.getInputVariables() + ") (out: " + op.getOutputVariables()
+ ")");
         return buffer.toString();
     }
 
@@ -315,10 +315,17 @@ public class LogicalOperatorPrettyPrintVisitor implements ILogicalOperatorVisito
     @Override
     public String visitInsertDeleteOperator(InsertDeleteOperator op, Integer indent) throws
AlgebricksException {
         StringBuilder buffer = new StringBuilder();
-        String header = op.getOperation() == Kind.INSERT ? "insert into " : "delete from
";
-        addIndent(buffer, indent).append(header).append(op.getDataSource()).append(" from
")
-                .append(op.getPayloadExpression().getValue().accept(exprVisitor, indent)).append("
partitioned by ");
+        if (op.getOperation() == Kind.INSERT)
+            addIndent(buffer, indent).append("insert ")
+                    .append(op.getPayloadExpression().getValue().accept(exprVisitor, indent)).append("
into ");
+        else
+            addIndent(buffer, indent).append("delete from ");
+        buffer.append(op.getDataSource()).append(" partitioned by ");
         pprintExprList(op.getPrimaryKeyExpressions(), buffer, indent);
+        if (op.getAdditionalFilteringExpressions() != null) {
+            buffer.append(" filtered by ");
+            pprintExprList(op.getAdditionalFilteringExpressions(), buffer, indent);
+        }
         if (op.isBulkload()) {
             buffer.append(" [bulkload]");
         }
@@ -329,10 +336,18 @@ public class LogicalOperatorPrettyPrintVisitor implements ILogicalOperatorVisito
     public String visitIndexInsertDeleteOperator(IndexInsertDeleteOperator op, Integer indent)
             throws AlgebricksException {
         StringBuilder buffer = new StringBuilder();
-        String header = op.getOperation() == Kind.INSERT ? "insert into " : "delete from
";
-        addIndent(buffer, indent).append(header).append(op.getIndexName()).append(" on ")
-                .append(op.getDataSourceIndex().getDataSource()).append(" from ");
+        addIndent(buffer, indent).append(op.getOperation() == Kind.INSERT ? "insert " : "delete
");
         pprintExprList(op.getSecondaryKeyExpressions(), buffer, indent);
+        buffer.append(op.getOperation() == Kind.INSERT ? " into " : " from ").append(op.getIndexName()).append("
on ")
+                .append(op.getDataSourceIndex().getDataSource()).append(" partitioned by
");
+        pprintExprList(op.getPrimaryKeyExpressions(), buffer, indent);
+        if (op.getFilterExpression() != null || op.getAdditionalFilteringExpressions() !=
null) {
+            buffer.append(" filtered by ");
+            if (op.getFilterExpression() != null)
+                buffer.append(op.getFilterExpression().getValue().accept(exprVisitor, indent));
+            if (op.getAdditionalFilteringExpressions() != null)
+                pprintExprList(op.getAdditionalFilteringExpressions(), buffer, indent);
+        }
         if (op.isBulkload()) {
             buffer.append(" [bulkload]");
         }
@@ -427,8 +442,8 @@ public class LogicalOperatorPrettyPrintVisitor implements ILogicalOperatorVisito
     public String visitExternalDataLookupOperator(ExternalDataLookupOperator op, Integer
indent)
             throws AlgebricksException {
         StringBuilder buffer = new StringBuilder();
-        addIndent(buffer, indent).append(
-                "external-instant-lookup " + op.getVariables() + " <- " + op.getExpressionRef().getValue());
+        addIndent(buffer, indent)
+                .append("external-instant-lookup " + op.getVariables() + " <- " + op.getExpressionRef().getValue());
         return buffer.toString();
     }
 


Mime
View raw message