minor, more log for dictionary value not exist exception

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

Branch: refs/heads/master-hbase0.98
Commit: b53f2b6d0bed3e426fbb3ba184cb8fe44018c286
Parents: 06e4027
Author: Li Yang <liy...@apache.org>
Authored: Tue Mar 14 13:40:53 2017 +0800
Committer: Li Yang <liy...@apache.org>
Committed: Tue Mar 14 13:40:53 2017 +0800

----------------------------------------------------------------------
 .../org/apache/kylin/cube/gridtable/CubeCodeSystem.java | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/b53f2b6d/core-cube/src/main/java/org/apache/kylin/cube/gridtable/CubeCodeSystem.java
----------------------------------------------------------------------
diff --git 
a/core-cube/src/main/java/org/apache/kylin/cube/gridtable/CubeCodeSystem.java 
b/core-cube/src/main/java/org/apache/kylin/cube/gridtable/CubeCodeSystem.java
index aeeb893..aaa12a7 100644
--- 
a/core-cube/src/main/java/org/apache/kylin/cube/gridtable/CubeCodeSystem.java
+++ 
b/core-cube/src/main/java/org/apache/kylin/cube/gridtable/CubeCodeSystem.java
@@ -19,9 +19,11 @@
 package org.apache.kylin.cube.gridtable;
 
 import java.nio.ByteBuffer;
+import java.nio.charset.Charset;
 import java.util.Collections;
 import java.util.Map;
 
+import org.apache.kylin.common.util.Bytes;
 import org.apache.kylin.common.util.ImmutableBitSet;
 import org.apache.kylin.dimension.DictionaryDimEnc;
 import org.apache.kylin.dimension.DictionaryDimEnc.DictionarySerializer;
@@ -121,7 +123,7 @@ public class CubeCodeSystem implements IGTCodeSystem {
             try {
                 serializer.serialize(value, buf);
             } catch (IllegalArgumentException ex) {
-                IllegalArgumentException rewordEx = new 
IllegalArgumentException("Column " + col + " value '" + value + "' met 
dictionary error: " + ex.getMessage());
+                IllegalArgumentException rewordEx = new 
IllegalArgumentException("Column " + col + " value '" + toStringBinary(value) + 
"' met dictionary error: " + ex.getMessage());
                 rewordEx.setStackTrace(ex.getStackTrace());
                 throw rewordEx;
             }
@@ -134,6 +136,14 @@ public class CubeCodeSystem implements IGTCodeSystem {
         }
     }
 
+    private String toStringBinary(Object value) {
+        if (value == null)
+            return "Null";
+        byte[] bytes;
+        bytes = value.toString().getBytes(Charset.forName("UTF-8"));
+        return Bytes.toStringBinary(bytes);
+    }
+
     @Override
     public Object decodeColumnValue(int col, ByteBuffer buf) {
         return serializers[col].deserialize(buf);

Reply via email to