You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2022/01/19 19:56:04 UTC

[GitHub] [iceberg] szehon-ho commented on a change in pull request #3760: NPE in Parquet Writer Metrics when writing un-truncatable strings

szehon-ho commented on a change in pull request #3760:
URL: https://github.com/apache/iceberg/pull/3760#discussion_r788090373



##########
File path: parquet/src/main/java/org/apache/iceberg/parquet/ParquetUtil.java
##########
@@ -287,11 +287,19 @@ private static void increment(Map<Integer, Long> columns, int fieldId, long amou
         int truncateLength = truncateMode.length();
         switch (type.typeId()) {
           case STRING:
-            upperBounds.put(id, UnicodeUtil.truncateStringMax((Literal<CharSequence>) max, truncateLength));
+            Literal<CharSequence> truncatedMaxString = UnicodeUtil.truncateStringMax((Literal<CharSequence>) max,
+                truncateLength);
+            if (truncatedMaxString != null) {
+              upperBounds.put(id, truncatedMaxString);
+            }
             break;
           case FIXED:
           case BINARY:
-            upperBounds.put(id, BinaryUtil.truncateBinaryMax((Literal<ByteBuffer>) max, truncateLength));
+            Literal<ByteBuffer> truncatedMaxBinary = BinaryUtil.truncateBinaryMax((Literal<ByteBuffer>) max,

Review comment:
       yep, will give a try




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org