You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by li...@apache.org on 2015/03/21 01:28:14 UTC

[10/29] incubator-kylin git commit: KYLIN-648

KYLIN-648


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

Branch: refs/heads/staging
Commit: 014ef833b8f0eff75ca5240d23adf1973419bd0f
Parents: cf99527
Author: Li, Yang <ya...@ebay.com>
Authored: Thu Mar 19 22:30:19 2015 +0800
Committer: Li, Yang <ya...@ebay.com>
Committed: Thu Mar 19 22:30:19 2015 +0800

----------------------------------------------------------------------
 query/src/test/resources/query/sql/query78.sql       |  4 ++++
 .../kylin/storage/hbase/CubeStorageEngine.java       | 15 ++++++++++-----
 2 files changed, 14 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/014ef833/query/src/test/resources/query/sql/query78.sql
----------------------------------------------------------------------
diff --git a/query/src/test/resources/query/sql/query78.sql b/query/src/test/resources/query/sql/query78.sql
new file mode 100644
index 0000000..f1d8fb2
--- /dev/null
+++ b/query/src/test/resources/query/sql/query78.sql
@@ -0,0 +1,4 @@
+select sum(PRICE), LSTG_FORMAT_NAME
+from test_kylin_fact
+where (LSTG_FORMAT_NAME in ('ABIN')) or  (LSTG_FORMAT_NAME>='FP-GTC' and LSTG_FORMAT_NAME<='Others')
+group by LSTG_FORMAT_NAME

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/014ef833/storage/src/main/java/org/apache/kylin/storage/hbase/CubeStorageEngine.java
----------------------------------------------------------------------
diff --git a/storage/src/main/java/org/apache/kylin/storage/hbase/CubeStorageEngine.java b/storage/src/main/java/org/apache/kylin/storage/hbase/CubeStorageEngine.java
index a4ecc2a..8737e8c 100644
--- a/storage/src/main/java/org/apache/kylin/storage/hbase/CubeStorageEngine.java
+++ b/storage/src/main/java/org/apache/kylin/storage/hbase/CubeStorageEngine.java
@@ -109,7 +109,7 @@ public class CubeStorageEngine implements IStorageEngine {
         context.setExactAggregation(isExactAggregation);
 
         // translate filter for scan range and compose returning groups for coprocessor, note:
-        // - columns on evaluate-able filter have to return
+        // - columns on non-evaluatable filter have to return
         // - columns on loosened filter (due to derived translation) have to return
         Set<TblColRef> groupsCopD = Sets.newHashSet(groupsD);
         groupsCopD.addAll(context.getOtherMandatoryColumns()); // TODO: this is tricky, to generalize
@@ -538,8 +538,10 @@ public class CubeStorageEngine implements IStorageEngine {
             List<Pair<byte[], byte[]>> newFuzzyKeys = new ArrayList<Pair<byte[], byte[]>>(mergeSize);
             List<Collection<ColumnValueRange>> newFlatOrAndFilter = Lists.newLinkedList();
 
+            boolean hasNonFuzzyRange = false;
             for (int k = from; k <= to; k++) {
                 HBaseKeyRange nextRange = keyRanges.get(k);
+                hasNonFuzzyRange = hasNonFuzzyRange || nextRange.getFuzzyKeys().isEmpty();
                 newFuzzyKeys.addAll(nextRange.getFuzzyKeys());
                 newFlatOrAndFilter.addAll(nextRange.getFlatOrAndFilter());
                 if (Bytes.compareTo(stopKey, nextRange.getStopKey()) < 0) {
@@ -553,11 +555,14 @@ public class CubeStorageEngine implements IStorageEngine {
                 }
             }
 
+            // if any range is non-fuzzy, then all fuzzy keys must be cleared
+            if (hasNonFuzzyRange) {
+                newFuzzyKeys.clear();
+            }
+
             partitionColumnStartDate = (partitionColumnStartDate == Long.MAX_VALUE) ? 0 : partitionColumnStartDate;
             partitionColumnEndDate = (partitionColumnEndDate == 0) ? Long.MAX_VALUE : partitionColumnEndDate;
-            keyRange =
-
-            new HBaseKeyRange(cubeSegment, cuboid, startKey, stopKey, newFuzzyKeys, newFlatOrAndFilter, partitionColumnStartDate, partitionColumnEndDate);
+            keyRange = new HBaseKeyRange(cubeSegment, cuboid, startKey, stopKey, newFuzzyKeys, newFlatOrAndFilter, partitionColumnStartDate, partitionColumnEndDate);
         }
         return keyRange;
     }
@@ -605,7 +610,7 @@ public class CubeStorageEngine implements IStorageEngine {
     }
 
     private void setLimit(TupleFilter filter, StorageContext context) {
-        boolean goodAggr = context.isExactAggregation() ;
+        boolean goodAggr = context.isExactAggregation();
         boolean goodFilter = filter == null || (TupleFilter.isEvaluableRecursively(filter) && context.isCoprocessorEnabled());
         boolean goodSort = context.hasSort() == false;
         if (goodAggr && goodFilter && goodSort) {