kylin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From liy...@apache.org
Subject [04/27] kylin git commit: minor, massin udf reverse
Date Fri, 02 Dec 2016 13:18:57 GMT
minor, massin udf reverse

Signed-off-by: Hongbin Ma <mahongbin@apache.org>


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

Branch: refs/heads/KYLIN-1875
Commit: b1b90adbe896e808776caf49ad7172979cf860df
Parents: 875a593
Author: Roger Shi <rogershijicheng@hotmail.com>
Authored: Wed Nov 30 13:35:12 2016 +0800
Committer: Hongbin Ma <mahongbin@apache.org>
Committed: Wed Nov 30 13:49:16 2016 +0800

----------------------------------------------------------------------
 .../metadata/filter/UDF/MassInTupleFilter.java  | 28 +++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/b1b90adb/core-metadata/src/main/java/org/apache/kylin/metadata/filter/UDF/MassInTupleFilter.java
----------------------------------------------------------------------
diff --git a/core-metadata/src/main/java/org/apache/kylin/metadata/filter/UDF/MassInTupleFilter.java
b/core-metadata/src/main/java/org/apache/kylin/metadata/filter/UDF/MassInTupleFilter.java
index 3f0546c..29c5550 100644
--- a/core-metadata/src/main/java/org/apache/kylin/metadata/filter/UDF/MassInTupleFilter.java
+++ b/core-metadata/src/main/java/org/apache/kylin/metadata/filter/UDF/MassInTupleFilter.java
@@ -50,6 +50,7 @@ public class MassInTupleFilter extends FunctionTupleFilter {
     private String filterTableName;//key in MetadataManager.extFilterMap
     private String filterTableResourceIdentifier;//HDFS path, or hbase table name depending
on FilterTableType
     private Functions.FilterTableType filterTableType;
+    private boolean reverse = false;
 
     public MassInTupleFilter() {
         super(Lists.<TupleFilter> newArrayList(), TupleFilter.FilterOperatorEnum.MASSIN);
@@ -66,7 +67,18 @@ public class MassInTupleFilter extends FunctionTupleFilter {
             valueProvider = VALUE_PROVIDER_FACTORY.getProvider(filterTableType, filterTableResourceIdentifier,
column);
         }
         boolean ret = valueProvider.getMassInValues().contains(colValue);
-        return ret;
+        return reverse ? !ret : ret;
+    }
+
+    @Override
+    public TupleFilter reverse() {
+        try {
+            MassInTupleFilter result = (MassInTupleFilter) this.clone();
+            result.setReverse(!this.isReverse());
+            return result;
+        } catch (CloneNotSupportedException e) {
+            throw new UnsupportedOperationException(e);
+        }
     }
 
     @Override
@@ -144,4 +156,18 @@ public class MassInTupleFilter extends FunctionTupleFilter {
         return false;
     }
 
+    public boolean isReverse() {
+        return reverse;
+    }
+
+    public void setReverse(boolean reverse) {
+        this.reverse = reverse;
+    }
+
+    @Override
+    protected Object clone() throws CloneNotSupportedException {
+        MassInTupleFilter result = new MassInTupleFilter();
+        result.setReverse(this.isReverse());
+        return result;
+    }
 }


Mime
View raw message