You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by sh...@apache.org on 2018/08/22 08:53:22 UTC

[kylin] branch 2.4.x updated (ba36ae2 -> 866858a)

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

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


    from ba36ae2  KYLIN-3424 invoke addCubingGarbageCollectionSteps in the cleanup step for HBaseMROutput2Transition
     new a398fb2  KYLIN-3505 Fix wrong usage of cache in DataType
     new 866858a  KYLIN-3507 Avoid NPE when project is not found

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:
 .../main/java/org/apache/kylin/metadata/datatype/DataType.java    | 8 ++++----
 .../src/main/java/org/apache/kylin/rest/service/QueryService.java | 6 ++++++
 2 files changed, 10 insertions(+), 4 deletions(-)


[kylin] 02/02: KYLIN-3507 Avoid NPE when project is not found

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

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

commit 866858a462f506dc08aeace1626854998d188821
Author: hujixu <hu...@youzan.com>
AuthorDate: Wed Aug 22 14:59:21 2018 +0800

    KYLIN-3507 Avoid NPE when project is not found
---
 .../src/main/java/org/apache/kylin/rest/service/QueryService.java   | 6 ++++++
 1 file changed, 6 insertions(+)

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 4e3fe07..ad5f6ef 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
@@ -76,6 +76,7 @@ import org.apache.kylin.metadata.model.JoinTableDesc;
 import org.apache.kylin.metadata.model.ModelDimensionDesc;
 import org.apache.kylin.metadata.model.TableRef;
 import org.apache.kylin.metadata.project.ProjectInstance;
+import org.apache.kylin.metadata.project.ProjectManager;
 import org.apache.kylin.metadata.querymeta.ColumnMeta;
 import org.apache.kylin.metadata.querymeta.ColumnMetaWithType;
 import org.apache.kylin.metadata.querymeta.SelectedColumnMeta;
@@ -338,6 +339,11 @@ public class QueryService extends BasicService {
         if (StringUtils.isBlank(sqlRequest.getProject())) {
             throw new BadRequestException(msg.getEMPTY_PROJECT_NAME());
         }
+        // project not found
+        ProjectManager mgr = ProjectManager.getInstance(KylinConfig.getInstanceFromEnv());
+        if (mgr.getProject(sqlRequest.getProject()) == null) {
+            throw new BadRequestException(msg.getPROJECT_NOT_FOUND());
+        }
         if (StringUtils.isBlank(sqlRequest.getSql())) {
             throw new BadRequestException(msg.getNULL_EMPTY_SQL());
         }


[kylin] 01/02: KYLIN-3505 Fix wrong usage of cache in DataType

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

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

commit a398fb2ea3280c4f364a3a139bd5e6ce80dc0b4f
Author: ian4hu <hu...@163.com>
AuthorDate: Tue Aug 21 17:23:19 2018 +0800

    KYLIN-3505 Fix wrong usage of cache in DataType
---
 .../main/java/org/apache/kylin/metadata/datatype/DataType.java    | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/core-metadata/src/main/java/org/apache/kylin/metadata/datatype/DataType.java b/core-metadata/src/main/java/org/apache/kylin/metadata/datatype/DataType.java
index 5ccc1f3..1b105f7 100644
--- a/core-metadata/src/main/java/org/apache/kylin/metadata/datatype/DataType.java
+++ b/core-metadata/src/main/java/org/apache/kylin/metadata/datatype/DataType.java
@@ -126,7 +126,7 @@ public class DataType implements Serializable {
         LEGACY_TYPE_MAP.put("hllc16", "hllc(16)");
     }
 
-    private static final ConcurrentMap<DataType, DataType> CACHE = new ConcurrentHashMap<DataType, DataType>();
+    private static final ConcurrentMap<String, DataType> CACHE = new ConcurrentHashMap<String, DataType>();
 
     public static final DataType ANY = DataType.getType("any");
 
@@ -144,10 +144,10 @@ public class DataType implements Serializable {
         if (type == null)
             return null;
 
-        DataType dataType = new DataType(type);
-        DataType cached = CACHE.get(dataType);
+        DataType cached = CACHE.get(type);
         if (cached == null) {
-            CACHE.put(dataType, dataType);
+            DataType dataType = new DataType(type);
+            CACHE.put(type, dataType);
             cached = dataType;
         }
         return cached;