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 2017/11/03 15:13:09 UTC

[1/3] kylin git commit: APACHE-KYLIN-2971: move OLAPContext.clearThreadLocalContexts() to the beginning of running a query

Repository: kylin
Updated Branches:
  refs/heads/dong-merge [created] 1d0c4d4fd


APACHE-KYLIN-2971: move OLAPContext.clearThreadLocalContexts() to the beginning of running a query

Signed-off-by: lidongsjtu <li...@apache.org>

This closes #83


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

Branch: refs/heads/dong-merge
Commit: e6bb40ae203d270fa35b964dbe5eb020f9c2ee5b
Parents: 188124f
Author: Zhong <nj...@apache.org>
Authored: Fri Nov 3 09:40:43 2017 +0800
Committer: lidongsjtu <li...@apache.org>
Committed: Fri Nov 3 22:54:25 2017 +0800

----------------------------------------------------------------------
 .../main/java/org/apache/kylin/rest/service/QueryService.java   | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/e6bb40ae/server-base/src/main/java/org/apache/kylin/rest/service/QueryService.java
----------------------------------------------------------------------
diff --git a/server-base/src/main/java/org/apache/kylin/rest/service/QueryService.java b/server-base/src/main/java/org/apache/kylin/rest/service/QueryService.java
index f8566de..26b25d2 100644
--- a/server-base/src/main/java/org/apache/kylin/rest/service/QueryService.java
+++ b/server-base/src/main/java/org/apache/kylin/rest/service/QueryService.java
@@ -400,6 +400,9 @@ public class QueryService extends BasicService {
 
             long startTime = System.currentTimeMillis();
 
+            // force clear the query context before a new query
+            OLAPContext.clearThreadLocalContexts();
+
             SQLResponse sqlResponse = null;
             boolean queryCacheEnabled = checkCondition(kylinConfig.isQueryCacheEnabled(),
                     "query cache disabled in KylinConfig") && //
@@ -557,8 +560,6 @@ public class QueryService extends BasicService {
             parameters.put(OLAPContext.PRM_USER_AUTHEN_INFO, userInfo);
             parameters.put(OLAPContext.PRM_ACCEPT_PARTIAL_RESULT, String.valueOf(sqlRequest.isAcceptPartial()));
             OLAPContext.setParameters(parameters);
-            // force clear the query context before a new query
-            OLAPContext.clearThreadLocalContexts();
 
             return execute(correctedSql, sqlRequest, conn);
 


[3/3] kylin git commit: APACHE-KYLIN-2969: Fix compatible issue of NumberDictionary

Posted by li...@apache.org.
APACHE-KYLIN-2969: Fix compatible issue of NumberDictionary

Signed-off-by: Zhong <nj...@apache.org>
Signed-off-by: lidongsjtu <li...@apache.org>


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

Branch: refs/heads/dong-merge
Commit: 1d0c4d4fddfc0d858b2173b0c37c8dc5f6b3d0bc
Parents: 16f7ade
Author: Ma Gang <mg...@163.com>
Authored: Wed Oct 25 18:25:12 2017 +0800
Committer: lidongsjtu <li...@apache.org>
Committed: Fri Nov 3 22:58:32 2017 +0800

----------------------------------------------------------------------
 .../org/apache/kylin/dict/Number2BytesConverter.java  | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/1d0c4d4f/core-dictionary/src/main/java/org/apache/kylin/dict/Number2BytesConverter.java
----------------------------------------------------------------------
diff --git a/core-dictionary/src/main/java/org/apache/kylin/dict/Number2BytesConverter.java b/core-dictionary/src/main/java/org/apache/kylin/dict/Number2BytesConverter.java
index 397ca9f..09c4c81 100644
--- a/core-dictionary/src/main/java/org/apache/kylin/dict/Number2BytesConverter.java
+++ b/core-dictionary/src/main/java/org/apache/kylin/dict/Number2BytesConverter.java
@@ -19,9 +19,12 @@ package org.apache.kylin.dict;
 
 import java.io.Serializable;
 import java.math.BigDecimal;
+import java.util.Map;
 
 import org.apache.kylin.common.util.Bytes;
 
+import com.google.common.collect.Maps;
+
 /**
  * Created by xiefan on 17-1-20.
  */
@@ -35,13 +38,18 @@ public class Number2BytesConverter implements BytesConverter<String>, Serializab
 
     int maxDigitsBeforeDecimalPoint;
 
-    static final transient ThreadLocal<NumberBytesCodec> LOCAL = new ThreadLocal<NumberBytesCodec>();
+    static final transient ThreadLocal<Map<Integer, NumberBytesCodec>> LOCAL = new ThreadLocal<Map<Integer, NumberBytesCodec>>();
 
     static NumberBytesCodec getCodec(int maxDigitsBeforeDecimalPoint) {
-        NumberBytesCodec codec = LOCAL.get();
+        Map<Integer, NumberBytesCodec> codecMap = LOCAL.get();
+        if (codecMap == null) {
+            codecMap = Maps.newHashMap();
+            LOCAL.set(codecMap);
+        }
+        NumberBytesCodec codec = codecMap.get(maxDigitsBeforeDecimalPoint);
         if (codec == null) {
             codec = new NumberBytesCodec(maxDigitsBeforeDecimalPoint);
-            LOCAL.set(codec);
+            codecMap.put(maxDigitsBeforeDecimalPoint, codec);
         }
         return codec;
     }


[2/3] kylin git commit: APACHE-KYLIN-2987: Skip moving to Trash when drop an intermediate hive table or redistribute a hive table

Posted by li...@apache.org.
APACHE-KYLIN-2987: Skip moving to Trash when drop an intermediate hive table or redistribute a hive table

Signed-off-by: Zhong <nj...@apache.org>
Signed-off-by: lidongsjtu <li...@apache.org>


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

Branch: refs/heads/dong-merge
Commit: 16f7ade4439a5916a1db017ab2d8bcf51cfba567
Parents: e6bb40a
Author: Wang Ken <mi...@ebay.com>
Authored: Fri Nov 3 09:03:02 2017 +0800
Committer: lidongsjtu <li...@apache.org>
Committed: Fri Nov 3 22:55:17 2017 +0800

----------------------------------------------------------------------
 core-job/src/main/java/org/apache/kylin/job/JoinedFlatTable.java   | 1 +
 .../src/main/java/org/apache/kylin/source/hive/HiveMRInput.java    | 2 ++
 2 files changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/16f7ade4/core-job/src/main/java/org/apache/kylin/job/JoinedFlatTable.java
----------------------------------------------------------------------
diff --git a/core-job/src/main/java/org/apache/kylin/job/JoinedFlatTable.java b/core-job/src/main/java/org/apache/kylin/job/JoinedFlatTable.java
index 52308e5..9593718 100644
--- a/core-job/src/main/java/org/apache/kylin/job/JoinedFlatTable.java
+++ b/core-job/src/main/java/org/apache/kylin/job/JoinedFlatTable.java
@@ -78,6 +78,7 @@ public class JoinedFlatTable {
         }
         ddl.append("STORED AS " + format + "\n");
         ddl.append("LOCATION '" + getTableDir(flatDesc, storageDfsDir) + "';").append("\n");
+        ddl.append("ALTER TABLE " + flatDesc.getTableName() + " SET TBLPROPERTIES('auto.purge'='true');\n");
         return ddl.toString();
     }
 

http://git-wip-us.apache.org/repos/asf/kylin/blob/16f7ade4/source-hive/src/main/java/org/apache/kylin/source/hive/HiveMRInput.java
----------------------------------------------------------------------
diff --git a/source-hive/src/main/java/org/apache/kylin/source/hive/HiveMRInput.java b/source-hive/src/main/java/org/apache/kylin/source/hive/HiveMRInput.java
index 0041441..d989c85 100644
--- a/source-hive/src/main/java/org/apache/kylin/source/hive/HiveMRInput.java
+++ b/source-hive/src/main/java/org/apache/kylin/source/hive/HiveMRInput.java
@@ -223,6 +223,8 @@ public class HiveMRInput implements IMRInput {
                             .append("CREATE EXTERNAL TABLE IF NOT EXISTS " + intermediate + " LIKE " + identity + "\n");
                     createIntermediateTableHql.append("LOCATION '" + jobWorkingDir + "/" + intermediate + "';\n");
                     createIntermediateTableHql
+                            .append("ALTER TABLE " + intermediate + " SET TBLPROPERTIES('auto.purge'='true');\n");
+                    createIntermediateTableHql
                             .append("INSERT OVERWRITE TABLE " + intermediate + " SELECT * FROM " + identity + ";\n");
                     hiveCmdBuilder.addStatement(createIntermediateTableHql.toString());
                     hiveViewIntermediateTables = hiveViewIntermediateTables + intermediate + ";";