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/08/01 02:33:58 UTC

[04/15] kylin git commit: #1710 refine Computed Column duplicate check logic and error message

#1710 refine Computed Column duplicate check logic and error message

* #1710 refine Computed Column duplicate check logic and error message

* Minor revision for error message expression


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

Branch: refs/heads/2.1.x
Commit: 9cd49dcca47e3fc4b807f867a846e0848643519e
Parents: e2a0f48
Author: Hongbin Ma <ma...@kyligence.io>
Authored: Thu Jul 27 10:38:44 2017 +0800
Committer: Hongbin Ma <ma...@apache.org>
Committed: Thu Jul 27 10:40:53 2017 +0800

----------------------------------------------------------------------
 .../apache/kylin/metadata/model/DataModelDesc.java    | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/9cd49dcc/core-metadata/src/main/java/org/apache/kylin/metadata/model/DataModelDesc.java
----------------------------------------------------------------------
diff --git a/core-metadata/src/main/java/org/apache/kylin/metadata/model/DataModelDesc.java b/core-metadata/src/main/java/org/apache/kylin/metadata/model/DataModelDesc.java
index bc35e2a..dc2f301 100644
--- a/core-metadata/src/main/java/org/apache/kylin/metadata/model/DataModelDesc.java
+++ b/core-metadata/src/main/java/org/apache/kylin/metadata/model/DataModelDesc.java
@@ -495,17 +495,17 @@ public class DataModelDesc extends RootPersistentEntity {
                 DataModelDesc dataModelDesc = pair.getSecond();
                 ComputedColumnDesc cc = pair.getFirst();
 
-                if (StringUtils.equals(cc.getFullName(), newCCName) && !(cc.equals(newCC))) {
-                    throw new IllegalArgumentException(
-                            String.format("Computed column named %s is defined differently in model %s", newCCName,
-                                    dataModelDesc.getName()));
+                if (StringUtils.equalsIgnoreCase(cc.getFullName(), newCCName) && !(cc.equals(newCC))) {
+                    throw new IllegalArgumentException(String.format(
+                            "Column name for computed column %s is already used in model %s, you should apply the same expression ' %s ' here, or use a different column name.",
+                            newCCName, dataModelDesc.getName(), cc.getExpression()));
                 }
 
                 if (isTwoCCDefinitionEquals(cc.getExpression(), newCC.getExpression())
-                        && !StringUtils.equals(cc.getColumnName(), newCCColumnName)) {
+                        && !StringUtils.equalsIgnoreCase(cc.getColumnName(), newCCColumnName)) {
                     throw new IllegalArgumentException(String.format(
-                            "Duplicate expression of %s with computed column %s in model %s, keep same computed column name could suppress this",
-                            newCCColumnName, cc.getColumnName(), dataModelDesc.getName()));
+                            "Expression for computed column %s is already used in model %s, you should use the same column name with ' %s ' .",
+                            newCCName, dataModelDesc.getName(), cc.getColumnName()));
                 }
             }
             existingCCs.add(Pair.newPair(newCC, this));