kylin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kangkai...@apache.org
Subject [41/50] [abbrv] kylin git commit: KYLIN-2539 move FilterOptimizeTransformer to OLAPFilterRel
Date Thu, 13 Apr 2017 11:22:07 GMT
KYLIN-2539 move FilterOptimizeTransformer to OLAPFilterRel


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

Branch: refs/heads/KYLIN-2506
Commit: 794ef4d4375d03f490b0d1c5da7b5ce1a9dac75e
Parents: bd3b844
Author: Hongbin Ma <mahongbin@apache.org>
Authored: Tue Apr 11 13:49:12 2017 +0800
Committer: Hongbin Ma <mahongbin@apache.org>
Committed: Tue Apr 11 13:49:17 2017 +0800

----------------------------------------------------------------------
 .../test_case_data/sandbox/kylin.properties     |  2 +-
 .../apache/kylin/query/ITKylinQueryTest.java    |  4 +--
 .../kylin/query/relnode/OLAPFilterRel.java      | 28 +++++++++-----------
 3 files changed, 16 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/794ef4d4/examples/test_case_data/sandbox/kylin.properties
----------------------------------------------------------------------
diff --git a/examples/test_case_data/sandbox/kylin.properties b/examples/test_case_data/sandbox/kylin.properties
index 684b4dd..2a8f617 100644
--- a/examples/test_case_data/sandbox/kylin.properties
+++ b/examples/test_case_data/sandbox/kylin.properties
@@ -39,7 +39,7 @@ kylin.source.hive.client=cli
 ### STORAGE ###
 
 # The metadata store in hbase
-kylin.metadata.url=kylin_metadata@hbase
+kylin.metadata.url=kylin_ci_instance@hbase
 
 
 # The storage for final cube file in hbase

http://git-wip-us.apache.org/repos/asf/kylin/blob/794ef4d4/kylin-it/src/test/java/org/apache/kylin/query/ITKylinQueryTest.java
----------------------------------------------------------------------
diff --git a/kylin-it/src/test/java/org/apache/kylin/query/ITKylinQueryTest.java b/kylin-it/src/test/java/org/apache/kylin/query/ITKylinQueryTest.java
index cdaa10b..271b8ff 100644
--- a/kylin-it/src/test/java/org/apache/kylin/query/ITKylinQueryTest.java
+++ b/kylin-it/src/test/java/org/apache/kylin/query/ITKylinQueryTest.java
@@ -134,11 +134,11 @@ public class ITKylinQueryTest extends KylinTestBase {
     @Test
     public void testSingleRunQuery() throws Exception {
 
-        String queryFileName = getQueryFolderPrefix() + "src/test/resources/query/sql_verifyCount/query03.sql";
+        String queryFileName = getQueryFolderPrefix() + "src/test/resources/query/temp/query00.sql";
 
         File sqlFile = new File(queryFileName);
         if (sqlFile.exists()) {
-            //runSQL(sqlFile, true, true);
+            runSQL(sqlFile, true, true);
             runSQL(sqlFile, true, false);
         }
     }

http://git-wip-us.apache.org/repos/asf/kylin/blob/794ef4d4/query/src/main/java/org/apache/kylin/query/relnode/OLAPFilterRel.java
----------------------------------------------------------------------
diff --git a/query/src/main/java/org/apache/kylin/query/relnode/OLAPFilterRel.java b/query/src/main/java/org/apache/kylin/query/relnode/OLAPFilterRel.java
index 3fba1ee..0ee9204 100755
--- a/query/src/main/java/org/apache/kylin/query/relnode/OLAPFilterRel.java
+++ b/query/src/main/java/org/apache/kylin/query/relnode/OLAPFilterRel.java
@@ -20,7 +20,6 @@ package org.apache.kylin.query.relnode;
 
 import java.util.GregorianCalendar;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
@@ -70,6 +69,7 @@ import org.apache.kylin.metadata.model.TblColRef;
 
 import com.google.common.base.Preconditions;
 import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
 
 /**
  */
@@ -78,13 +78,10 @@ public class OLAPFilterRel extends Filter implements OLAPRel {
     private static class TupleFilterVisitor extends RexVisitorImpl<TupleFilter> {
 
         private final ColumnRowType inputRowType;
-        private final OLAPContext context;
-        private final Set<TblColRef> columnsInFilter = new HashSet<>();
 
-        public TupleFilterVisitor(ColumnRowType inputRowType, OLAPContext context) {
+        public TupleFilterVisitor(ColumnRowType inputRowType) {
             super(true);
             this.inputRowType = inputRowType;
-            this.context = context;
         }
 
         @Override
@@ -229,10 +226,6 @@ public class OLAPFilterRel extends Filter implements OLAPRel {
         @Override
         public TupleFilter visitInputRef(RexInputRef inputRef) {
             TblColRef column = inputRowType.getColumnByIndex(inputRef.getIndex());
-            if (!column.isInnerColumn()) {
-                context.allColumns.add(column);
-                columnsInFilter.add(column);
-            }
             ColumnTupleFilter filter = new ColumnTupleFilter(column);
             return filter;
         }
@@ -322,15 +315,20 @@ public class OLAPFilterRel extends Filter implements OLAPRel {
             return;
         }
 
-        TupleFilterVisitor visitor = new TupleFilterVisitor(this.columnRowType, context);
+        TupleFilterVisitor visitor = new TupleFilterVisitor(this.columnRowType);
         TupleFilter filter = this.condition.accept(visitor);
-
-        context.filter = TupleFilter.and(context.filter, filter);
-
         // optimize the filter, the optimization has to be segment-irrelevant
-        new FilterOptimizeTransformer().transform(context.filter);
+        new FilterOptimizeTransformer().transform(filter);
+        Set<TblColRef> filterColumns = Sets.newHashSet();
+        TupleFilter.collectColumns(filter, filterColumns);
+        for (TblColRef tblColRef : filterColumns) {
+            if (!tblColRef.isInnerColumn()) {
+                context.allColumns.add(tblColRef);
+                context.filterColumns.add(tblColRef);
+            }
+        }
 
-        context.filterColumns.addAll(visitor.columnsInFilter);
+        context.filter = TupleFilter.and(context.filter, filter);
     }
 
     @Override


Mime
View raw message