kylin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From liy...@apache.org
Subject incubator-kylin git commit: KYLIN-1039 Fix un-evaluatable in LogicalTupleFilter
Date Sat, 26 Sep 2015 02:23:59 GMT
Repository: incubator-kylin
Updated Branches:
  refs/heads/2.x-staging 1f4081f51 -> 89029f57b


KYLIN-1039 Fix un-evaluatable in LogicalTupleFilter


Project: http://git-wip-us.apache.org/repos/asf/incubator-kylin/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-kylin/commit/89029f57
Tree: http://git-wip-us.apache.org/repos/asf/incubator-kylin/tree/89029f57
Diff: http://git-wip-us.apache.org/repos/asf/incubator-kylin/diff/89029f57

Branch: refs/heads/2.x-staging
Commit: 89029f57be0d782c1aad9f61550fa67c1985a590
Parents: 1f4081f
Author: Yang Li <liyang@apache.org>
Authored: Sat Sep 26 10:23:43 2015 +0800
Committer: Yang Li <liyang@apache.org>
Committed: Sat Sep 26 10:23:43 2015 +0800

----------------------------------------------------------------------
 .../metadata/filter/LogicalTupleFilter.java     | 22 +++++++++++++++++++-
 .../common/coprocessor/FilterDecorator.java     |  7 +++----
 2 files changed, 24 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/89029f57/core-metadata/src/main/java/org/apache/kylin/metadata/filter/LogicalTupleFilter.java
----------------------------------------------------------------------
diff --git a/core-metadata/src/main/java/org/apache/kylin/metadata/filter/LogicalTupleFilter.java
b/core-metadata/src/main/java/org/apache/kylin/metadata/filter/LogicalTupleFilter.java
index e444a7d..83404eb 100644
--- a/core-metadata/src/main/java/org/apache/kylin/metadata/filter/LogicalTupleFilter.java
+++ b/core-metadata/src/main/java/org/apache/kylin/metadata/filter/LogicalTupleFilter.java
@@ -112,7 +112,27 @@ public class LogicalTupleFilter extends TupleFilter {
 
     @Override
     public boolean isEvaluable() {
-        return true;
+        switch (operator) {
+        case NOT:
+            // Un-evaluatable branch will be pruned and be replaced with TRUE.
+            // And this must happen at the top NOT, otherwise NOT (TRUE) becomes false.
+            for (TupleFilter child : children) {
+                if (TupleFilter.isEvaluableRecursively(child) == false)
+                    return false;
+            }
+            return true;
+        case OR:
+            // (anything OR un-evaluable) will become (anything or TRUE) which is effectively
TRUE.
+            // The "anything" is not evaluated, kinda disabled, by the un-evaluable part.
+            // If it's partially un-evaluable, then "anything" is partially disabled, and
the OR is still not fully evaluatable.
+            for (TupleFilter child : children) {
+                if (TupleFilter.isEvaluableRecursively(child) == false)
+                    return false;
+            }
+            return true;
+        default:
+            return true;
+        }
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/89029f57/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/common/coprocessor/FilterDecorator.java
----------------------------------------------------------------------
diff --git a/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/common/coprocessor/FilterDecorator.java
b/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/common/coprocessor/FilterDecorator.java
index 4fc922a..9b12bfd 100644
--- a/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/common/coprocessor/FilterDecorator.java
+++ b/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/common/coprocessor/FilterDecorator.java
@@ -129,10 +129,8 @@ public class FilterDecorator implements TupleFilterSerializer.Decorator
{
         if (filter == null)
             return null;
 
-        // In case of NOT(inEvaluatableFilter), we should immediately replace it as TRUE,
-        // Otherwise, inEvaluatableFilter will later be replace with TRUE and NOT(unEvaluatableFilter)
will
-        // always return FALSE
-        if (filter.getOperator() == TupleFilter.FilterOperatorEnum.NOT && !TupleFilter.isEvaluableRecursively(filter))
{
+        // un-evaluatable filter is replaced with TRUE
+        if (!filter.isEvaluable()) {
             TupleFilter.collectColumns(filter, inevaluableColumns);
             return ConstantTupleFilter.TRUE;
         }
@@ -140,6 +138,7 @@ public class FilterDecorator implements TupleFilterSerializer.Decorator
{
         if (!(filter instanceof CompareTupleFilter))
             return filter;
 
+        // double check all internal of CompareTupleFilter is evaluatable
         if (!TupleFilter.isEvaluableRecursively(filter)) {
             TupleFilter.collectColumns(filter, inevaluableColumns);
             return ConstantTupleFilter.TRUE;


Mime
View raw message