You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by ma...@apache.org on 2015/11/16 07:39:49 UTC

incubator-kylin git commit: KYLIN-1144 fix ut

Repository: incubator-kylin
Updated Branches:
  refs/heads/2.x-staging 0a8b6d3a2 -> 0273a145f


KYLIN-1144 fix ut


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

Branch: refs/heads/2.x-staging
Commit: 0273a145f9b1f6d921f906718d3828afbedbaf2a
Parents: 0a8b6d3
Author: honma <ho...@ebay.com>
Authored: Mon Nov 16 14:45:10 2015 +0800
Committer: honma <ho...@ebay.com>
Committed: Mon Nov 16 14:45:10 2015 +0800

----------------------------------------------------------------------
 .../kylin/storage/cache/CacheFledgedDynamicQuery.java       | 3 ++-
 .../apache/kylin/storage/cache/CacheFledgedStaticQuery.java | 3 ++-
 .../org/apache/kylin/storage/cache/DynamicCacheTest.java    | 9 +++++++++
 .../org/apache/kylin/storage/cache/StaticCacheTest.java     | 7 +++++++
 .../apache/kylin/rest/controller/QueryControllerTest.java   | 8 +++++++-
 5 files changed, 27 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/0273a145/core-storage/src/main/java/org/apache/kylin/storage/cache/CacheFledgedDynamicQuery.java
----------------------------------------------------------------------
diff --git a/core-storage/src/main/java/org/apache/kylin/storage/cache/CacheFledgedDynamicQuery.java b/core-storage/src/main/java/org/apache/kylin/storage/cache/CacheFledgedDynamicQuery.java
index b9808ea..e1d5ee3 100644
--- a/core-storage/src/main/java/org/apache/kylin/storage/cache/CacheFledgedDynamicQuery.java
+++ b/core-storage/src/main/java/org/apache/kylin/storage/cache/CacheFledgedDynamicQuery.java
@@ -60,7 +60,8 @@ public class CacheFledgedDynamicQuery extends AbstractCacheFledgedQuery {
         boolean enableDynamicCache = sqlDigest.groupbyColumns.contains(partitionColRef);
 
         if (enableDynamicCache) {
-            StreamSQLResult cachedResult = getStreamSQLResult(new StreamSQLDigest(sqlDigest, partitionColRef));
+            streamSQLDigest = new StreamSQLDigest(sqlDigest, partitionColRef);
+            StreamSQLResult cachedResult = getStreamSQLResult(streamSQLDigest);
             if (cachedResult != null) {
                 ret = tryReuseCache(context, sqlDigest, returnTupleInfo, cachedResult);
             } else {

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/0273a145/core-storage/src/main/java/org/apache/kylin/storage/cache/CacheFledgedStaticQuery.java
----------------------------------------------------------------------
diff --git a/core-storage/src/main/java/org/apache/kylin/storage/cache/CacheFledgedStaticQuery.java b/core-storage/src/main/java/org/apache/kylin/storage/cache/CacheFledgedStaticQuery.java
index d024cf7..af1b34c 100644
--- a/core-storage/src/main/java/org/apache/kylin/storage/cache/CacheFledgedStaticQuery.java
+++ b/core-storage/src/main/java/org/apache/kylin/storage/cache/CacheFledgedStaticQuery.java
@@ -28,7 +28,8 @@ public class CacheFledgedStaticQuery extends AbstractCacheFledgedQuery {
     @Override
     public ITupleIterator search(final StorageContext context, final SQLDigest sqlDigest, final TupleInfo returnTupleInfo) {
 
-        StreamSQLResult cachedResult = getStreamSQLResult(new StreamSQLDigest(sqlDigest, null));
+        streamSQLDigest = new StreamSQLDigest(sqlDigest, null);
+        StreamSQLResult cachedResult = getStreamSQLResult(streamSQLDigest);
         ITupleIterator ret;
 
         if (cachedResult != null) {

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/0273a145/core-storage/src/test/java/org/apache/kylin/storage/cache/DynamicCacheTest.java
----------------------------------------------------------------------
diff --git a/core-storage/src/test/java/org/apache/kylin/storage/cache/DynamicCacheTest.java b/core-storage/src/test/java/org/apache/kylin/storage/cache/DynamicCacheTest.java
index 161cad6..1011b1a 100644
--- a/core-storage/src/test/java/org/apache/kylin/storage/cache/DynamicCacheTest.java
+++ b/core-storage/src/test/java/org/apache/kylin/storage/cache/DynamicCacheTest.java
@@ -6,6 +6,7 @@ import java.util.List;
 import java.util.concurrent.atomic.AtomicInteger;
 
 import org.apache.commons.lang.NotImplementedException;
+import org.apache.kylin.common.KylinConfig;
 import org.apache.kylin.common.util.DateFormat;
 import org.apache.kylin.common.util.IdentityUtils;
 import org.apache.kylin.metadata.model.FunctionDesc;
@@ -20,6 +21,7 @@ import org.apache.kylin.storage.StorageContext;
 import org.apache.kylin.storage.tuple.Tuple;
 import org.apache.kylin.storage.tuple.TupleInfo;
 import org.junit.Assert;
+import org.junit.BeforeClass;
 import org.junit.Test;
 
 import com.google.common.collect.Lists;
@@ -30,6 +32,13 @@ import com.google.common.collect.Ranges;
  */
 public class DynamicCacheTest {
 
+    @BeforeClass
+    public static void setup() {
+        System.setProperty(KylinConfig.KYLIN_CONF, "../examples/test_case_data/sandbox");
+        KylinConfig.getInstanceFromEnv().setProperty("kylin.query.cache.threshold.duration", "0");
+    }
+
+
     class TsOnlyTuple implements ITuple {
         private TblColRef partitionCol;
         private String tsStr;

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/0273a145/core-storage/src/test/java/org/apache/kylin/storage/cache/StaticCacheTest.java
----------------------------------------------------------------------
diff --git a/core-storage/src/test/java/org/apache/kylin/storage/cache/StaticCacheTest.java b/core-storage/src/test/java/org/apache/kylin/storage/cache/StaticCacheTest.java
index 48b0b1d..09e289b 100644
--- a/core-storage/src/test/java/org/apache/kylin/storage/cache/StaticCacheTest.java
+++ b/core-storage/src/test/java/org/apache/kylin/storage/cache/StaticCacheTest.java
@@ -6,6 +6,7 @@ import java.util.IdentityHashMap;
 import java.util.List;
 import java.util.concurrent.atomic.AtomicInteger;
 
+import org.apache.kylin.common.KylinConfig;
 import org.apache.kylin.common.util.IdentityUtils;
 import org.apache.kylin.metadata.filter.TupleFilter;
 import org.apache.kylin.metadata.model.FunctionDesc;
@@ -20,6 +21,7 @@ import org.apache.kylin.storage.StorageContext;
 import org.apache.kylin.storage.tuple.Tuple;
 import org.apache.kylin.storage.tuple.TupleInfo;
 import org.junit.Assert;
+import org.junit.BeforeClass;
 import org.junit.Test;
 
 import com.google.common.collect.Lists;
@@ -28,6 +30,11 @@ import com.google.common.collect.Range;
 /**
  */
 public class StaticCacheTest {
+    @BeforeClass
+    public static void setup() {
+        System.setProperty(KylinConfig.KYLIN_CONF, "../examples/test_case_data/sandbox");
+        KylinConfig.getInstanceFromEnv().setProperty("kylin.query.cache.threshold.duration", "0");
+    }
 
     @Test
     public void basicTest() {

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/0273a145/server/src/test/java/org/apache/kylin/rest/controller/QueryControllerTest.java
----------------------------------------------------------------------
diff --git a/server/src/test/java/org/apache/kylin/rest/controller/QueryControllerTest.java b/server/src/test/java/org/apache/kylin/rest/controller/QueryControllerTest.java
index b985146..c42a0f6 100644
--- a/server/src/test/java/org/apache/kylin/rest/controller/QueryControllerTest.java
+++ b/server/src/test/java/org/apache/kylin/rest/controller/QueryControllerTest.java
@@ -23,9 +23,11 @@ import net.sf.ehcache.CacheManager;
 import org.apache.kylin.metadata.project.ProjectInstance;
 import org.apache.kylin.rest.request.MetaRequest;
 import org.apache.kylin.rest.request.SQLRequest;
+import org.apache.kylin.rest.response.SQLResponse;
 import org.apache.kylin.rest.service.QueryService;
 import org.apache.kylin.rest.service.ServiceTestBase;
 import org.apache.kylin.rest.util.QueryUtil;
+import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -55,7 +57,11 @@ public class QueryControllerTest extends ServiceTestBase {
         SQLRequest sqlRequest = new SQLRequest();
         sqlRequest.setSql("select * from not_exist_table");
         sqlRequest.setProject("default");
-        queryController.query(sqlRequest);
+        SQLResponse response1 = queryController.query(sqlRequest);
+        Assert.assertEquals(false, response1.getIsException());
+
+        SQLResponse response2 = queryController.query(sqlRequest);
+        Assert.assertEquals(false, response2.getIsException());
     }
 
     @Test