You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by dl...@apache.org on 2019/02/21 19:11:21 UTC

[asterixdb] branch master updated: [NO ISSUE][COMP] Optim rules comments + minor changes

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


The following commit(s) were added to refs/heads/master by this push:
     new 6dce59a  [NO ISSUE][COMP] Optim rules comments + minor changes
6dce59a is described below

commit 6dce59a3a20d666ddd03251cb74dc94a9e392748
Author: Hussain Towaileb <Hu...@Gmail.com>
AuthorDate: Wed Feb 20 01:19:19 2019 +0300

    [NO ISSUE][COMP] Optim rules comments + minor changes
    
    - user model changes: no
    - storage format changes: no
    - interface changes: no
    
    Details:
    - CheckFilterExpressionTypeRule checks if the optimization
    context has the output type environment before computing it.
    - Minor addition/changes to rule comments.
    
    Change-Id: I6f5cb78125657ff2bb4658af40bfc9d9cbff184e
    Reviewed-on: https://asterix-gerrit.ics.uci.edu/3201
    Sonar-Qube: Jenkins <je...@fulliautomatix.ics.uci.edu>
    Tested-by: Jenkins <je...@fulliautomatix.ics.uci.edu>
    Contrib: Jenkins <je...@fulliautomatix.ics.uci.edu>
    Integration-Tests: Jenkins <je...@fulliautomatix.ics.uci.edu>
    Reviewed-by: Dmitry Lychagin <dm...@couchbase.com>
---
 .../asterix/optimizer/rules/CheckFilterExpressionTypeRule.java      | 5 ++++-
 .../org/apache/asterix/om/typecomputer/impl/TypeComputeUtils.java   | 6 +++---
 .../apache/hyracks/algebricks/rewriter/rules/InferTypesRule.java    | 3 +++
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/CheckFilterExpressionTypeRule.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/CheckFilterExpressionTypeRule.java
index 4839ac3..fed54e2 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/CheckFilterExpressionTypeRule.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/CheckFilterExpressionTypeRule.java
@@ -61,7 +61,10 @@ public class CheckFilterExpressionTypeRule implements IAlgebraicRewriteRule {
         }
         SelectOperator select = (SelectOperator) op;
         ILogicalExpression condition = select.getCondition().getValue();
-        IVariableTypeEnvironment env = select.computeOutputTypeEnvironment(context);
+
+        // Get the output type environment
+        IVariableTypeEnvironment env = context.getOutputTypeEnvironment(select);
+
         IAType condType = (IAType) env.getType(condition);
         if (condType.getTypeTag() != ATypeTag.BOOLEAN && condType.getTypeTag() != ATypeTag.ANY
                 && !isPossibleBoolean(condType)) {
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/impl/TypeComputeUtils.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/impl/TypeComputeUtils.java
index f1f1be3..e40975b 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/impl/TypeComputeUtils.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/impl/TypeComputeUtils.java
@@ -84,7 +84,7 @@ public class TypeComputeUtils {
             inputTypes[index++] = (IAType) env.getType(arg);
         }
 
-        // Checks input types and computes result types.
+        // Checks input types.
         IAType[] knownInputTypes = TypeComputeUtils.getActualType(inputTypes);
         boolean[] unknownable = TypeComputeUtils.isUnknownableType(inputTypes);
         for (int argIndex = 0; argIndex < knownInputTypes.length; ++argIndex) {
@@ -97,7 +97,7 @@ public class TypeComputeUtils {
         }
 
         // Computes the result type.
-        byte category = TypeComputeUtils.resolveCateogry(inputTypes);
+        byte category = TypeComputeUtils.resolveCategory(inputTypes);
         if (propagateNullAndMissing) {
             if (category == MISSING) {
                 return BuiltinType.AMISSING;
@@ -126,7 +126,7 @@ public class TypeComputeUtils {
         }
     }
 
-    private static byte resolveCateogry(IAType... inputTypes) {
+    private static byte resolveCategory(IAType... inputTypes) {
         byte category = CERTAIN;
         boolean meetNull = false;
         for (IAType inputType : inputTypes) {
diff --git a/hyracks-fullstack/algebricks/algebricks-rewriter/src/main/java/org/apache/hyracks/algebricks/rewriter/rules/InferTypesRule.java b/hyracks-fullstack/algebricks/algebricks-rewriter/src/main/java/org/apache/hyracks/algebricks/rewriter/rules/InferTypesRule.java
index 8d54a67..a17bbf7 100644
--- a/hyracks-fullstack/algebricks/algebricks-rewriter/src/main/java/org/apache/hyracks/algebricks/rewriter/rules/InferTypesRule.java
+++ b/hyracks-fullstack/algebricks/algebricks-rewriter/src/main/java/org/apache/hyracks/algebricks/rewriter/rules/InferTypesRule.java
@@ -25,6 +25,9 @@ import org.apache.hyracks.algebricks.core.algebra.base.ILogicalOperator;
 import org.apache.hyracks.algebricks.core.algebra.base.IOptimizationContext;
 import org.apache.hyracks.algebricks.core.rewriter.base.IAlgebraicRewriteRule;
 
+/**
+ * This rule computes and sets the output type environment for each operator in the plan
+ */
 public class InferTypesRule implements IAlgebraicRewriteRule {
 
     @Override