kylin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mahong...@apache.org
Subject [02/17] kylin git commit: minor, avoid verbose logging in Serializer
Date Tue, 26 Jan 2016 13:41:38 GMT
minor, avoid verbose logging in Serializer


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

Branch: refs/heads/2.x-staging
Commit: d2673969fb40436d1c55f359b2b709c55cfab8da
Parents: 0d29d63
Author: honma <honma@ebay.com>
Authored: Tue Jan 26 09:54:57 2016 +0800
Committer: honma <honma@ebay.com>
Committed: Tue Jan 26 21:40:48 2016 +0800

----------------------------------------------------------------------
 .../java/org/apache/kylin/cube/gridtable/FixLenSerializer.java  | 5 ++++-
 .../apache/kylin/metadata/datatype/BigDecimalSerializer.java    | 4 ++--
 2 files changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/d2673969/core-cube/src/main/java/org/apache/kylin/cube/gridtable/FixLenSerializer.java
----------------------------------------------------------------------
diff --git a/core-cube/src/main/java/org/apache/kylin/cube/gridtable/FixLenSerializer.java
b/core-cube/src/main/java/org/apache/kylin/cube/gridtable/FixLenSerializer.java
index 2b70e79..24c4a19 100644
--- a/core-cube/src/main/java/org/apache/kylin/cube/gridtable/FixLenSerializer.java
+++ b/core-cube/src/main/java/org/apache/kylin/cube/gridtable/FixLenSerializer.java
@@ -36,6 +36,7 @@ public class FixLenSerializer extends DataTypeSerializer {
     private ThreadLocal<byte[]> current = new ThreadLocal<byte[]>();
 
     private int fixLen;
+    transient int avoidVerbose = 0;
 
     FixLenSerializer(int fixLen) {
         this.fixLen = fixLen;
@@ -59,7 +60,9 @@ public class FixLenSerializer extends DataTypeSerializer {
         } else {
             byte[] bytes = Bytes.toBytes(value.toString());
             if (bytes.length > fixLen) {
-                logger.warn("Expect at most " + fixLen + " bytes, but got " + bytes.length
+ ", will truncate, value string: " + value.toString());
+                if (avoidVerbose++ % 10000 == 0) {
+                    logger.warn("Expect at most " + fixLen + " bytes, but got " + bytes.length
+ ", will truncate, value string: " + value.toString() + " times:" + avoidVerbose);
+                }
             }
             out.put(bytes, 0, Math.min(bytes.length, fixLen));
             for (int i = bytes.length; i < fixLen; i++) {

http://git-wip-us.apache.org/repos/asf/kylin/blob/d2673969/core-metadata/src/main/java/org/apache/kylin/metadata/datatype/BigDecimalSerializer.java
----------------------------------------------------------------------
diff --git a/core-metadata/src/main/java/org/apache/kylin/metadata/datatype/BigDecimalSerializer.java
b/core-metadata/src/main/java/org/apache/kylin/metadata/datatype/BigDecimalSerializer.java
index 25b4e07..64968b8 100644
--- a/core-metadata/src/main/java/org/apache/kylin/metadata/datatype/BigDecimalSerializer.java
+++ b/core-metadata/src/main/java/org/apache/kylin/metadata/datatype/BigDecimalSerializer.java
@@ -48,8 +48,8 @@ public class BigDecimalSerializer extends DataTypeSerializer<BigDecimal>
{
     @Override
     public void serialize(BigDecimal value, ByteBuffer out) {
         if (value.scale() > type.getScale()) {
-            if (avoidVerbose % 10000 == 0) {
-                logger.warn("value's scale has exceeded the " + type.getScale() + ", cut
it off, to ensure encoded value do not exceed maxLength " + maxLength + " times:" + (avoidVerbose++));
+            if (avoidVerbose++ % 10000 == 0) {
+                logger.warn("value's scale has exceeded the " + type.getScale() + ", cut
it off, to ensure encoded value do not exceed maxLength " + maxLength + " times:" + (avoidVerbose));
             }
             value = value.setScale(type.getScale(), BigDecimal.ROUND_HALF_EVEN);
         }


Mime
View raw message