Repository: kylin
Updated Branches:
  refs/heads/KYLIN-2192 [created] 5683e33d8


http://git-wip-us.apache.org/repos/asf/kylin/blob/5683e33d/core-dictionary/src/test/java/org/apache/kylin/dict/CachedTreeMapTest.java
----------------------------------------------------------------------
diff --git 
a/core-dictionary/src/test/java/org/apache/kylin/dict/CachedTreeMapTest.java 
b/core-dictionary/src/test/java/org/apache/kylin/dict/CachedTreeMapTest.java
index df64f3f..381e0b1 100644
--- a/core-dictionary/src/test/java/org/apache/kylin/dict/CachedTreeMapTest.java
+++ b/core-dictionary/src/test/java/org/apache/kylin/dict/CachedTreeMapTest.java
@@ -17,11 +17,12 @@
 */
 package org.apache.kylin.dict;
 
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.*;
 import org.apache.hadoop.io.Writable;
 import org.apache.hadoop.io.WritableComparable;
 import org.junit.After;
 import org.junit.AfterClass;
-import org.junit.Before;
 import org.junit.Test;
 
 import java.io.*;
@@ -91,39 +92,26 @@ public class CachedTreeMapTest {
     public static class CachedFileFilter implements FileFilter {
         @Override
         public boolean accept(File pathname) {
-            return pathname.getName().startsWith("cached_");
+            return pathname.getName().startsWith(CachedTreeMap.CACHED_PREFIX);
         }
     }
 
-    public static final String baseDir = "/tmp/kylin_cachedtreemap_test/";
-    public static final String backupDir = 
"/tmp/kylin_cachedtreemap_test.bak/";
-    public static final String tmpDir = "/tmp/kylin_cachedtreemap_test.tmp/";
-
-    private static void cleanup() {
-        File dir = new File(baseDir);
-        if (dir.exists()) {
-            for (File f : dir.listFiles()) {
-                f.delete();
-            }
-            dir.delete();
-        }
-
-        dir = new File(tmpDir);
-        if (dir.exists()) {
-            for (File f : dir.listFiles()) {
-                f.delete();
-            }
-            dir.delete();
+    public static class VersionFilter implements FileFilter {
+        @Override
+        public boolean accept(File pathname) {
+            return pathname.getName().startsWith(CachedTreeMap.VERSION_PREFIX);
         }
+    }
 
-        dir = new File(backupDir);
-        if (dir.exists()) {
-            for (File f : dir.listFiles()) {
-                f.delete();
-            }
-            dir.delete();
-        }
+    public static final String baseDir = "/tmp/kylin_cachedtreemap_test/";
+    public static final String workingDir = 
"/tmp/kylin_cachedtreemap_test/working";
 
+    private static void cleanup() {
+        Configuration conf = new Configuration();
+        Path basePath = new Path(baseDir);
+        try {
+            FileSystem.get(basePath.toUri(), conf).delete(basePath, true);
+        } catch (IOException e) {}
         VALUE_WRITE_ERROR_TOGGLE = false;
     }
 
@@ -139,154 +127,240 @@ public class CachedTreeMapTest {
 
     @Test
     public void testCachedTreeMap() throws IOException {
-        CachedTreeMap map = 
CachedTreeMap.CachedTreeMapBuilder.newBuilder().baseDir(baseDir)
-                
.persistent(true).immutable(false).maxSize(2).keyClazz(Key.class).valueClazz(Value.class).build();
+        CachedTreeMap map = createMutableMap();
         map.put(Key.of(1), Value.of("a"));
         map.put(Key.of(2), Value.of("b"));
         map.put(Key.of(3), Value.of("c"));
         map.put(Key.of(4), Value.of("d"));
         map.put(Key.of(5), Value.of("e"));
 
-        File dir = new File(tmpDir);
+        File dir = new File(workingDir);
         assertEquals(3, dir.listFiles(new CachedFileFilter()).length);
 
-        DataOutputStream out = new DataOutputStream(new 
FileOutputStream(tmpDir+"/.index"));
-        map.write(out);
-        out.flush();
-        out.close();
-        map.commit(false);
+        flushAndCommit(map, true, true, false);
+        assertFalse(new File(workingDir).exists());
 
-        dir = new File(baseDir);
+        dir = new File(map.getLatestVersion());
         assertEquals(5, dir.listFiles(new CachedFileFilter()).length);
 
-        DataInputStream in = new DataInputStream(new 
FileInputStream(baseDir+".index"));
-        CachedTreeMap map2 = 
CachedTreeMap.CachedTreeMapBuilder.newBuilder().baseDir(baseDir)
-                
.persistent(true).immutable(true).maxSize(2).keyClazz(Key.class).valueClazz(Value.class).build();
-        map2.readFields(in);
+        CachedTreeMap map2 = createImmutableMap();
         assertEquals(5, map2.size());
         assertEquals("b", ((Value)map2.get(Key.of(2))).valueStr);
 
         try {
             map2.put(Key.of(6), Value.of("f"));
             fail("Should be error when put value into immutable map");
-        } catch (AssertionError error) {
+        } catch (AssertionError error) {}
+    }
+
+    @Test
+    public void testMultiVersions() throws IOException, InterruptedException {
+        CachedTreeMap map = createMutableMap();
+        Thread.sleep(3000);
+        map.put(Key.of(1), Value.of("a"));
+        map.put(Key.of(2), Value.of("b"));
+        map.put(Key.of(3), Value.of("c"));
+        flushAndCommit(map, true, true, false);
+
+        CachedTreeMap map2 = createImmutableMap();
+        assertEquals("b", ((Value)map2.get(Key.of(2))).valueStr);
+
+        // re-open dict, append new data
+        map = createMutableMap();
+        map.put(Key.of(4), Value.of("d"));
+        flushAndCommit(map, true, true, true);
+
+        // new data is not visible for map2
+        assertNull(map2.get(Key.of(4)));
+
+        // append data, and be visible for new immutable map
+        map.put(Key.of(5), Value.of("e"));
+        flushAndCommit(map, true, true, true);
+
+        CachedTreeMap map3 = createImmutableMap();
+        assertEquals("d", ((Value)map3.get(Key.of(4))).valueStr);
+        assertEquals("e", ((Value)map3.get(Key.of(5))).valueStr);
+
+        // Check versions retention
+        File dir = new File(baseDir);
+        assertEquals(3, dir.listFiles(new VersionFilter()).length);
+    }
+
+    @Test
+    public void testKeepAppend() throws IOException {
+        CachedTreeMap map = createMutableMap();
+        map.put(Key.of(1), Value.of("a"));
+        map.put(Key.of(2), Value.of("b"));
+        map.put(Key.of(3), Value.of("c"));
+        map.put(Key.of(4), Value.of("d"));
+        map.put(Key.of(5), Value.of("e"));
+
+        // flush with keepAppend false, map can't be append
+        flushAndCommit(map, true, true, false);
+        // append into map has closed
+        try {
+            map.put(Key.of(6), Value.of("f"));
+            fail();
+        } catch (AssertionError e) {
+            assertEquals("Only support put method with immutable false and 
keepAppend true", e.getMessage());
         }
 
-        assertFalse(new File(tmpDir).exists());
-        assertFalse(new File(backupDir).exists());
+        CachedTreeMap map2 = createImmutableMap();
+        assertEquals("a", ((Value)map2.get(Key.of(1))).valueStr);
+        assertEquals("d", ((Value)map2.get(Key.of(4))).valueStr);
+        assertEquals("e", ((Value)map2.get(Key.of(5))).valueStr);
+
+        map = createMutableMap();
+        map.put(Key.of(6), Value.of("f"));
+        map.put(Key.of(7), Value.of("g"));
+        map.put(Key.of(8), Value.of("h"));
+        // flush with keepAppend true
+        flushAndCommit(map, true, true, true);
+        map.put(Key.of(9), Value.of("i"));
+        // can still append data
+        flushAndCommit(map, true, true, false);
+
+        map2 = createImmutableMap();
+        assertEquals("a", ((Value)map2.get(Key.of(1))).valueStr);
+        assertEquals("d", ((Value)map2.get(Key.of(4))).valueStr);
+        assertEquals("f", ((Value)map2.get(Key.of(6))).valueStr);
+        assertEquals("i", ((Value)map2.get(Key.of(9))).valueStr);
+    }
+
+    @Test
+    public void testVersionRetention() throws IOException, 
InterruptedException {
+        File dir = new File(baseDir);
+        // TTL for 3s and keep 3 versions
+        CachedTreeMap map = 
CachedTreeMap.CachedTreeMapBuilder.newBuilder().baseDir(baseDir)
+            
.immutable(false).maxSize(2).keyClazz(Key.class).valueClazz(Value.class)
+            .maxVersions(3).versionTTL(1000 * 3).build();
+        map.put(Key.of(1), Value.of("a"));
+
+        // has version 0 when create map
+        assertEquals(1, dir.listFiles(new VersionFilter()).length);
+        Thread.sleep(2500);
+
+        // flush version 1
+        flushAndCommit(map, true, true, true);
+        assertEquals(2, dir.listFiles(new VersionFilter()).length);
+
+        // flush version 2
+        flushAndCommit(map, true, true, true);
+        assertEquals(3, dir.listFiles(new VersionFilter()).length);
+
+        // flush version 3
+        flushAndCommit(map, true, true, true);
+        // won't delete version since 3s TTL
+        assertEquals(4, dir.listFiles(new VersionFilter()).length);
+
+        // sleep to make version 0 expired
+        Thread.sleep(500);
+        // flush verion 4
+        flushAndCommit(map, true, true, false);
+        assertEquals(4, dir.listFiles(new VersionFilter()).length);
+
+        // TTL for 100ms and keep 2 versions
+        map = CachedTreeMap.CachedTreeMapBuilder.newBuilder().baseDir(baseDir)
+            
.immutable(false).maxSize(2).keyClazz(Key.class).valueClazz(Value.class)
+            .maxVersions(2).versionTTL(100).build();
+        flushAndCommit(map, true, true, false);
+        assertEquals(2, dir.listFiles(new VersionFilter()).length);
+    }
+
+    @Test
+    public void testWithOldFormat() throws IOException {
+        File dir = new File(baseDir);
+        CachedTreeMap map = createMutableMap();
+        map.put(Key.of(1), Value.of("a"));
+        map.put(Key.of(2), Value.of("b"));
+        map.put(Key.of(3), Value.of("c"));
+        map.put(Key.of(4), Value.of("d"));
+        map.put(Key.of(5), Value.of("e"));
+        flushAndCommit(map, true, true, true);
+
+        // move version dir to base dir, to simulate the older format
+        Path versionPath = new Path(map.getLatestVersion());
+        Path tmpVersionPath = new Path(versionPath.getParent().getParent(), 
versionPath.getName());
+        Configuration conf = new Configuration();
+        FileSystem fs = FileSystem.get(versionPath.toUri(), conf);
+        fs.rename(versionPath, tmpVersionPath);
+        fs.delete(new Path(baseDir), true);
+        fs.rename(tmpVersionPath, new Path(baseDir));
+        assertEquals(0, dir.listFiles(new VersionFilter()).length);
+        assertEquals(5, dir.listFiles(new CachedFileFilter()).length);
+
+        CachedTreeMap map2 = createImmutableMap();
+        assertEquals(5, map2.size());
+        assertEquals("a", ((Value)map2.get(Key.of(1))).valueStr);
+        assertEquals("e", ((Value)map2.get(Key.of(5))).valueStr);
+
+        assertEquals(1, dir.listFiles(new VersionFilter()).length);
+        assertEquals(0, dir.listFiles(new CachedFileFilter()).length);
     }
 
     @Test
     public void testWriteFailed() throws IOException {
         // normal case
-        CachedTreeMap map = 
CachedTreeMap.CachedTreeMapBuilder.newBuilder().baseDir(baseDir)
-                
.persistent(true).immutable(false).maxSize(2).keyClazz(Key.class).valueClazz(Value.class).build();
+        CachedTreeMap map = createMutableMap();
         map.put(Key.of(1), Value.of("a"));
         map.put(Key.of(2), Value.of("b"));
         map.put(Key.of(3), Value.of("c"));
         map.remove(Key.of(3));
         map.put(Key.of(4), Value.of("d"));
 
-        DataOutputStream out = new DataOutputStream(new 
FileOutputStream(tmpDir+".index"));
-        map.write(out);
-        out.flush();
-        out.close();
-        map.commit(false);
+        flushAndCommit(map, true, true, false);
 
-        DataInputStream in = new DataInputStream(new 
FileInputStream(baseDir+".index"));
-        CachedTreeMap map2 = 
CachedTreeMap.CachedTreeMapBuilder.newBuilder().baseDir(baseDir)
-                
.persistent(true).immutable(true).maxSize(2).keyClazz(Key.class).valueClazz(Value.class).build();
-        map2.readFields(in);
+        CachedTreeMap map2 = createImmutableMap();
         assertEquals(3, map2.size());
         assertEquals("a", ((Value)map2.get(Key.of(1))).valueStr);
 
         // suppose write value failed and didn't commit data
-        map = CachedTreeMap.CachedTreeMapBuilder.newBuilder().baseDir(baseDir)
-                
.persistent(true).immutable(false).maxSize(2).keyClazz(Key.class).valueClazz(Value.class).build();
+        map = createMutableMap();
         VALUE_WRITE_ERROR_TOGGLE = true;
         map.put(Key.of(1), Value.of("aa"));
         map.put(Key.of(2), Value.of("bb"));
         VALUE_WRITE_ERROR_TOGGLE = false;
         map.put(Key.of(3), Value.of("cc"));
         map.put(Key.of(4), Value.of("dd"));
-        out = new DataOutputStream(new FileOutputStream(tmpDir+".index"));
-        map.write(out);
-        out.flush();
-        out.close();
         // suppose write value failed and didn't commit data
-        //map.commit(false);
+        flushAndCommit(map, true, false, false);
 
         // read map data should not be modified
-        in = new DataInputStream(new FileInputStream(baseDir+".index"));
-        map2 = CachedTreeMap.CachedTreeMapBuilder.newBuilder().baseDir(baseDir)
-                
.persistent(true).immutable(true).maxSize(2).keyClazz(Key.class).valueClazz(Value.class).build();
-        map2.readFields(in);
+        map2 = createImmutableMap();
         assertEquals(3, map2.size());
         assertEquals("a", ((Value)map2.get(Key.of(1))).valueStr);
 
-        assertTrue(new File(tmpDir).exists());
-        assertFalse(new File(backupDir).exists());
+        assertTrue(new File(workingDir).exists());
     }
 
-    @Test
-    public void testCommit() throws IOException {
+    private CachedTreeMap createImmutableMap() throws IOException {
         CachedTreeMap map = 
CachedTreeMap.CachedTreeMapBuilder.newBuilder().baseDir(baseDir)
-                
.persistent(true).immutable(false).maxSize(2).keyClazz(Key.class).valueClazz(Value.class).build();
-        map.put(Key.of(1), Value.of("a"));
-        map.put(Key.of(2), Value.of("b"));
-        map.put(Key.of(3), Value.of("c"));
-        map.put(Key.of(4), Value.of("d"));
-
-        DataOutputStream out = new DataOutputStream(new 
FileOutputStream(tmpDir+".index"));
-        map.write(out);
-        out.flush();
-        out.close();
-        map.commit(true);
-
-        assertTrue(new File(tmpDir).exists());
-        assertFalse(new File(backupDir).exists());
+            
.immutable(true).maxSize(2).keyClazz(Key.class).valueClazz(Value.class).build();
+        try (DataInputStream in = map.openIndexInput()) {
+            map.readFields(in);
+        }
+        return map;
+    }
 
-        DataInputStream in = new DataInputStream(new 
FileInputStream(baseDir+".index"));
-        CachedTreeMap map2 = 
CachedTreeMap.CachedTreeMapBuilder.newBuilder().baseDir(baseDir)
-                
.persistent(true).immutable(true).maxSize(2).keyClazz(Key.class).valueClazz(Value.class).build();
-        map2.readFields(in);
-        assertEquals(4, map2.size());
-        assertEquals("a", ((Value)map2.get(Key.of(1))).valueStr);
+    private CachedTreeMap createMutableMap() throws IOException {
+        CachedTreeMap map = 
CachedTreeMap.CachedTreeMapBuilder.newBuilder().baseDir(baseDir)
+            .immutable(false).maxSize(2).maxVersions(3).versionTTL(1000 * 
3).keyClazz(Key.class).valueClazz(Value.class).build();
+        try (DataInputStream in = map.openIndexInput()) {
+            map.readFields(in);
+        } catch (IOException e) {}
+        return map;
+    }
 
-        // continue modify map, but not commit
-        map.put(Key.of(1), Value.of("aa"));
-        map.put(Key.of(2), Value.of("bb"));
-        map.put(Key.of(3), Value.of("cc"));
-        map.put(Key.of(5), Value.of("e"));
-        map.put(Key.of(6), Value.of("f"));
-        out = new DataOutputStream(new FileOutputStream(tmpDir+".index"));
-        map.write(out);
-        out.flush();
-        out.close();
-
-        assertTrue(new File(tmpDir).exists());
-        assertEquals(6, new File(tmpDir).listFiles(new 
CachedFileFilter()).length);
-        assertEquals(4, new File(baseDir).listFiles(new 
CachedFileFilter()).length);
-
-        in = new DataInputStream(new FileInputStream(baseDir+".index"));
-        map2 = CachedTreeMap.CachedTreeMapBuilder.newBuilder().baseDir(baseDir)
-                
.persistent(true).immutable(true).maxSize(2).keyClazz(Key.class).valueClazz(Value.class).build();
-        map2.readFields(in);
-        assertEquals(4, map2.size());
-        assertEquals("a", ((Value)map2.get(Key.of(1))).valueStr);
+    private void flushAndCommit(CachedTreeMap map, boolean doFlush, boolean 
doCommit, boolean keepAppend) throws IOException {
+        if (doFlush) {
+            try (DataOutputStream out = map.openIndexOutput()) {
+                map.write(out);
+            }
+        }
 
-        // commit data
-        map.commit(false);
-        assertFalse(new File(tmpDir).exists());
-        assertEquals(6, new File(baseDir).listFiles(new 
CachedFileFilter()).length);
-
-        in = new DataInputStream(new FileInputStream(baseDir+".index"));
-        map2 = CachedTreeMap.CachedTreeMapBuilder.newBuilder().baseDir(baseDir)
-                
.persistent(true).immutable(true).maxSize(2).keyClazz(Key.class).valueClazz(Value.class).build();
-        map2.readFields(in);
-        assertEquals(6, map2.size());
-        assertEquals("aa", ((Value)map2.get(Key.of(1))).valueStr);
-        assertEquals("f", ((Value)map2.get(Key.of(6))).valueStr);
+        if (doCommit) {
+            map.commit(keepAppend);
+        }
     }
 }
 

http://git-wip-us.apache.org/repos/asf/kylin/blob/5683e33d/core-metadata/src/test/java/org/apache/kylin/measure/bitmap/BitmapCounterTest.java
----------------------------------------------------------------------
diff --git 
a/core-metadata/src/test/java/org/apache/kylin/measure/bitmap/BitmapCounterTest.java
 
b/core-metadata/src/test/java/org/apache/kylin/measure/bitmap/BitmapCounterTest.java
index f0e21cf..f7796c0 100644
--- 
a/core-metadata/src/test/java/org/apache/kylin/measure/bitmap/BitmapCounterTest.java
+++ 
b/core-metadata/src/test/java/org/apache/kylin/measure/bitmap/BitmapCounterTest.java
@@ -44,10 +44,12 @@ public class BitmapCounterTest {
         counter2.add(12273456);
         counter2.add("4258");
         counter2.add(123);
-        assertEquals(4, counter2.getCount());
+        counter2.add(-2147483648);
+        counter2.add(-2);
+        assertEquals(6, counter2.getCount());
 
         counter.merge(counter2);
-        assertEquals(6, counter.getCount());
+        assertEquals(8, counter.getCount());
         System.out.print("counter size: " + counter.getMemBytes() + ", 
counter2 size: " + counter2.getMemBytes());
     }
 

http://git-wip-us.apache.org/repos/asf/kylin/blob/5683e33d/examples/test_case_data/localmeta/cube_desc/test_kylin_cube_without_slr_left_join_desc.json
----------------------------------------------------------------------
diff --git 
a/examples/test_case_data/localmeta/cube_desc/test_kylin_cube_without_slr_left_join_desc.json
 
b/examples/test_case_data/localmeta/cube_desc/test_kylin_cube_without_slr_left_join_desc.json
index 0470dc6..a16f949 100644
--- 
a/examples/test_case_data/localmeta/cube_desc/test_kylin_cube_without_slr_left_join_desc.json
+++ 
b/examples/test_case_data/localmeta/cube_desc/test_kylin_cube_without_slr_left_join_desc.json
@@ -116,12 +116,12 @@
     },
     "dependent_measure_ref" : null
   }, {
-    "name" : "SITE_NAME_BITMAP",
+    "name" : "PRICE_BITMAP",
     "function" : {
       "expression" : "COUNT_DISTINCT",
       "parameter" : {
         "type" : "column",
-        "value" : "SITE_NAME",
+        "value" : "PRICE",
         "next_parameter" : null
       },
       "returntype" : "bitmap"
@@ -211,7 +211,7 @@
   } ],
   "dictionaries" : [
     {
-      "column" : "SITE_NAME",
+      "column" : "PRICE",
       "builder": "org.apache.kylin.dict.GlobalDictionaryBuilder"
     }
   ],
@@ -257,7 +257,7 @@
       "name" : "f2",
       "columns" : [ {
         "qualifier" : "m",
-        "measure_refs" : [ "seller_cnt_bitmap", "site_name_bitmap", 
"seller_format_cnt"]
+        "measure_refs" : [ "seller_cnt_bitmap", "price_bitmap", 
"seller_format_cnt"]
       } ]
     }, {
       "name" : "f3",

http://git-wip-us.apache.org/repos/asf/kylin/blob/5683e33d/kylin-it/src/test/resources/query/sql_distinct_precisely/query00.sql
----------------------------------------------------------------------
diff --git 
a/kylin-it/src/test/resources/query/sql_distinct_precisely/query00.sql 
b/kylin-it/src/test/resources/query/sql_distinct_precisely/query00.sql
index a3948c3..28d73bc 100644
--- a/kylin-it/src/test/resources/query/sql_distinct_precisely/query00.sql
+++ b/kylin-it/src/test/resources/query/sql_distinct_precisely/query00.sql
@@ -19,6 +19,6 @@
 select lstg_format_name, cal_dt,
  sum(price) as GMV,
  count(1) as TRANS_CNT,
- count(distinct seller_id) as seller_count
+ count(distinct price) as price_count
  from test_kylin_fact
  group by lstg_format_name, cal_dt

http://git-wip-us.apache.org/repos/asf/kylin/blob/5683e33d/kylin-it/src/test/resources/query/sql_distinct_precisely/query01.sql
----------------------------------------------------------------------
diff --git 
a/kylin-it/src/test/resources/query/sql_distinct_precisely/query01.sql 
b/kylin-it/src/test/resources/query/sql_distinct_precisely/query01.sql
index e8579ef..a965f77 100644
--- a/kylin-it/src/test/resources/query/sql_distinct_precisely/query01.sql
+++ b/kylin-it/src/test/resources/query/sql_distinct_precisely/query01.sql
@@ -19,7 +19,7 @@
 select lstg_format_name,
  sum(price) as GMV,
  count(1) as TRANS_CNT,
- count(distinct seller_id) as seller_count
+ count(distinct price) as price_count
  from test_kylin_fact
  where lstg_format_name='FP-GTC'
  group by lstg_format_name

http://git-wip-us.apache.org/repos/asf/kylin/blob/5683e33d/kylin-it/src/test/resources/query/sql_distinct_precisely/query02.sql
----------------------------------------------------------------------
diff --git 
a/kylin-it/src/test/resources/query/sql_distinct_precisely/query02.sql 
b/kylin-it/src/test/resources/query/sql_distinct_precisely/query02.sql
index 48f49e9..9fa9844 100644
--- a/kylin-it/src/test/resources/query/sql_distinct_precisely/query02.sql
+++ b/kylin-it/src/test/resources/query/sql_distinct_precisely/query02.sql
@@ -19,7 +19,7 @@
 select lstg_format_name,
  sum(price) as GMV,
  count(1) as TRANS_CNT,
- count(distinct seller_id) as seller_count
+ count(distinct price) as price_count
  from test_kylin_fact
  where lstg_format_name='FP-GTC'
  group by lstg_format_name

http://git-wip-us.apache.org/repos/asf/kylin/blob/5683e33d/kylin-it/src/test/resources/query/sql_distinct_precisely/query03.sql
----------------------------------------------------------------------
diff --git 
a/kylin-it/src/test/resources/query/sql_distinct_precisely/query03.sql 
b/kylin-it/src/test/resources/query/sql_distinct_precisely/query03.sql
index dbc2fac..1e26891 100644
--- a/kylin-it/src/test/resources/query/sql_distinct_precisely/query03.sql
+++ b/kylin-it/src/test/resources/query/sql_distinct_precisely/query03.sql
@@ -17,7 +17,8 @@
 --
 
 select test_cal_dt.week_beg_dt,sum(test_kylin_fact.price) as GMV
- , count(1) as TRANS_CNT, count(distinct seller_id) as seller_count
+ , count(1) as TRANS_CNT
+ , count(distinct price) as price_count
  , count(distinct site_name) as site_count
  from test_kylin_fact
  inner JOIN edw.test_cal_dt as test_cal_dt

http://git-wip-us.apache.org/repos/asf/kylin/blob/5683e33d/kylin-it/src/test/resources/query/sql_distinct_precisely/query04.sql
----------------------------------------------------------------------
diff --git 
a/kylin-it/src/test/resources/query/sql_distinct_precisely/query04.sql 
b/kylin-it/src/test/resources/query/sql_distinct_precisely/query04.sql
index 69006ce..60b936e 100644
--- a/kylin-it/src/test/resources/query/sql_distinct_precisely/query04.sql
+++ b/kylin-it/src/test/resources/query/sql_distinct_precisely/query04.sql
@@ -17,7 +17,8 @@
 --
 
 select test_cal_dt.week_beg_dt,sum(test_kylin_fact.price) as GMV
- , count(1) as TRANS_CNT, count(distinct seller_id) as seller_count
+ , count(1) as TRANS_CNT
+ , count(distinct price) as price_count
  , count(distinct site_name) as site_count
  from test_kylin_fact
  inner JOIN edw.test_cal_dt as test_cal_dt

http://git-wip-us.apache.org/repos/asf/kylin/blob/5683e33d/kylin-it/src/test/resources/query/sql_distinct_precisely/query05.sql
----------------------------------------------------------------------
diff --git 
a/kylin-it/src/test/resources/query/sql_distinct_precisely/query05.sql 
b/kylin-it/src/test/resources/query/sql_distinct_precisely/query05.sql
index dea09f7..1787d8d 100644
--- a/kylin-it/src/test/resources/query/sql_distinct_precisely/query05.sql
+++ b/kylin-it/src/test/resources/query/sql_distinct_precisely/query05.sql
@@ -19,7 +19,7 @@
 select lstg_format_name,
  sum(price) as GMV,
  count(1) as TRANS_CNT,
- count(distinct seller_id) as seller_count
+ count(distinct price) as price_count
  from test_kylin_fact
  group by lstg_format_name
  order by lstg_format_name

http://git-wip-us.apache.org/repos/asf/kylin/blob/5683e33d/kylin-it/src/test/resources/query/sql_distinct_precisely/query06.sql
----------------------------------------------------------------------
diff --git 
a/kylin-it/src/test/resources/query/sql_distinct_precisely/query06.sql 
b/kylin-it/src/test/resources/query/sql_distinct_precisely/query06.sql
index eb12620..08e6ffa 100644
--- a/kylin-it/src/test/resources/query/sql_distinct_precisely/query06.sql
+++ b/kylin-it/src/test/resources/query/sql_distinct_precisely/query06.sql
@@ -19,7 +19,7 @@
 select lstg_format_name,
  sum(price) as GMV,
  count(1) as TRANS_CNT,
- count(distinct seller_id) as seller_count
+ count(distinct price) as price_count
  from test_kylin_fact
  where lstg_format_name='FP-GTC'
  group by lstg_format_name

http://git-wip-us.apache.org/repos/asf/kylin/blob/5683e33d/kylin-it/src/test/resources/query/sql_distinct_precisely/query07.sql
----------------------------------------------------------------------
diff --git 
a/kylin-it/src/test/resources/query/sql_distinct_precisely/query07.sql 
b/kylin-it/src/test/resources/query/sql_distinct_precisely/query07.sql
index 9bd2663..4ffd606 100644
--- a/kylin-it/src/test/resources/query/sql_distinct_precisely/query07.sql
+++ b/kylin-it/src/test/resources/query/sql_distinct_precisely/query07.sql
@@ -19,6 +19,6 @@
 select lstg_format_name,
  sum(price) as GMV,
  count(1) as TRANS_CNT,
- count(distinct seller_id) as seller_count
+ count(distinct price) as price_count
  from test_kylin_fact
  group by lstg_format_name

Reply via email to