You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by bi...@apache.org on 2018/03/18 18:30:27 UTC

[kylin] branch 2.3.x updated (066ac49 -> d9561d0)

This is an automated email from the ASF dual-hosted git repository.

billyliu pushed a change to branch 2.3.x
in repository https://gitbox.apache.org/repos/asf/kylin.git.


    from 066ac49  KYLIN-3280 The delete button should not be enabled without any segment in cube segment delete confirm dialog
     new 6063945  KYLIN-3276 Fix query with different dynamic parameters get the same query result
     new d9561d0  KYLIN-3276 fix unstable it test case

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../org/apache/kylin/jdbc/ITJDBCDriverTest.java    | 27 ++++++++++++++++++++++
 .../kylin/rest/request/PrepareSqlRequest.java      | 18 ++++++++++++++-
 .../org/apache/kylin/rest/request/SQLRequest.java  |  2 +-
 3 files changed, 45 insertions(+), 2 deletions(-)

-- 
To stop receiving notification emails like this one, please contact
billyliu@apache.org.

[kylin] 01/02: KYLIN-3276 Fix query with different dynamic parameters get the same query result

Posted by bi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

billyliu pushed a commit to branch 2.3.x
in repository https://gitbox.apache.org/repos/asf/kylin.git

commit 60639456423a44ea6d88b0548fa3c1541db57e98
Author: nichunen <ch...@kyligence.io>
AuthorDate: Mon Mar 12 20:28:24 2018 +0800

    KYLIN-3276 Fix query with different dynamic parameters get the same query result
---
 .../org/apache/kylin/jdbc/ITJDBCDriverTest.java    | 27 ++++++++++++++++++++++
 .../kylin/rest/request/PrepareSqlRequest.java      | 18 ++++++++++++++-
 .../org/apache/kylin/rest/request/SQLRequest.java  |  2 +-
 3 files changed, 45 insertions(+), 2 deletions(-)

diff --git a/kylin-it/src/test/java/org/apache/kylin/jdbc/ITJDBCDriverTest.java b/kylin-it/src/test/java/org/apache/kylin/jdbc/ITJDBCDriverTest.java
index 765b12c..de5e193 100644
--- a/kylin-it/src/test/java/org/apache/kylin/jdbc/ITJDBCDriverTest.java
+++ b/kylin-it/src/test/java/org/apache/kylin/jdbc/ITJDBCDriverTest.java
@@ -301,6 +301,33 @@ public class ITJDBCDriverTest extends HBaseMetadataTestCase {
 
     }
 
+    @Test
+    public void testPreparedStatementWithCache() throws Exception {
+        Connection conn = getConnection();
+
+        PreparedStatement statement = conn
+                .prepareStatement("select count(1) as TRANS_CNT from test_kylin_fact where LSTG_FORMAT_NAME = ?");
+
+        statement.setString(1, "ABIN");
+        ResultSet rs = statement.executeQuery();
+        Assert.assertTrue(rs.next());
+        Object object = rs.getObject(1);
+        long countFirst = (long) object;
+
+        statement.setString(1, "FP-GTC");
+        rs = statement.executeQuery();
+        Assert.assertTrue(rs.next());
+        object = rs.getObject(1);
+        long countSecond = (long) object;
+
+        Assert.assertTrue(countFirst > countSecond);
+
+        rs.close();
+        statement.close();
+        conn.close();
+
+    }
+
     private static class SystemPropertiesOverride {
         HashMap<String, String> backup = new HashMap<String, String>();
 
diff --git a/server-base/src/main/java/org/apache/kylin/rest/request/PrepareSqlRequest.java b/server-base/src/main/java/org/apache/kylin/rest/request/PrepareSqlRequest.java
index e296248..97a4863 100644
--- a/server-base/src/main/java/org/apache/kylin/rest/request/PrepareSqlRequest.java
+++ b/server-base/src/main/java/org/apache/kylin/rest/request/PrepareSqlRequest.java
@@ -19,7 +19,9 @@
 package org.apache.kylin.rest.request;
 
 import java.io.Serializable;
+import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collections;
 
 /**
  * @author xduo
@@ -41,7 +43,7 @@ public class PrepareSqlRequest extends SQLRequest {
         this.params = params;
     }
 
-    public static class StateParam implements Serializable{
+    public static class StateParam implements Serializable {
         private String className;
         private String value;
 
@@ -97,6 +99,20 @@ public class PrepareSqlRequest extends SQLRequest {
     }
 
     @Override
+    public Object getCacheKey() {
+        if (cacheKey != null)
+            return cacheKey;
+
+        cacheKey = super.getCacheKey();
+
+        if (params != null) {
+            ArrayList keyList = (ArrayList) (cacheKey);
+            Collections.addAll(keyList, params);
+        }
+        return cacheKey;
+    }
+
+    @Override
     public int hashCode() {
         final int prime = 31;
         int result = super.hashCode();
diff --git a/server-base/src/main/java/org/apache/kylin/rest/request/SQLRequest.java b/server-base/src/main/java/org/apache/kylin/rest/request/SQLRequest.java
index 92533b8..56db745 100644
--- a/server-base/src/main/java/org/apache/kylin/rest/request/SQLRequest.java
+++ b/server-base/src/main/java/org/apache/kylin/rest/request/SQLRequest.java
@@ -39,7 +39,7 @@ public class SQLRequest implements Serializable {
 
     private Map<String, String> backdoorToggles;
 
-    private volatile Object cacheKey = null;
+    protected volatile Object cacheKey = null;
 
     public SQLRequest() {
     }

-- 
To stop receiving notification emails like this one, please contact
billyliu@apache.org.

[kylin] 02/02: KYLIN-3276 fix unstable it test case

Posted by bi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

billyliu pushed a commit to branch 2.3.x
in repository https://gitbox.apache.org/repos/asf/kylin.git

commit d9561d06e8e49f87d9fa9ff41a53c20e3291d162
Author: nichunen <ch...@kyligence.io>
AuthorDate: Tue Mar 13 22:36:27 2018 +0800

    KYLIN-3276 fix unstable it test case
---
 kylin-it/src/test/java/org/apache/kylin/jdbc/ITJDBCDriverTest.java | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/kylin-it/src/test/java/org/apache/kylin/jdbc/ITJDBCDriverTest.java b/kylin-it/src/test/java/org/apache/kylin/jdbc/ITJDBCDriverTest.java
index de5e193..eb3c773 100644
--- a/kylin-it/src/test/java/org/apache/kylin/jdbc/ITJDBCDriverTest.java
+++ b/kylin-it/src/test/java/org/apache/kylin/jdbc/ITJDBCDriverTest.java
@@ -306,15 +306,15 @@ public class ITJDBCDriverTest extends HBaseMetadataTestCase {
         Connection conn = getConnection();
 
         PreparedStatement statement = conn
-                .prepareStatement("select count(1) as TRANS_CNT from test_kylin_fact where LSTG_FORMAT_NAME = ?");
+                .prepareStatement("select count(1) as TRANS_CNT from test_kylin_fact where LSTG_FORMAT_NAME like ?");
 
-        statement.setString(1, "ABIN");
+        statement.setString(1, "%");
         ResultSet rs = statement.executeQuery();
         Assert.assertTrue(rs.next());
         Object object = rs.getObject(1);
         long countFirst = (long) object;
 
-        statement.setString(1, "FP-GTC");
+        statement.setString(1, "O%");
         rs = statement.executeQuery();
         Assert.assertTrue(rs.next());
         object = rs.getObject(1);

-- 
To stop receiving notification emails like this one, please contact
billyliu@apache.org.