rdblue commented on a change in pull request #665: PR#1 for merging 
vectorized-read branch into master
URL: https://github.com/apache/incubator-iceberg/pull/665#discussion_r349274632
 
 

 ##########
 File path: parquet/src/main/java/org/apache/iceberg/parquet/ParquetUtil.java
 ##########
 @@ -220,9 +231,132 @@ private static void increment(Map<Integer, Long> 
columns, int fieldId, long amou
   private static Map<Integer, ByteBuffer> toBufferMap(Schema schema, 
Map<Integer, Literal<?>> map) {
     Map<Integer, ByteBuffer> bufferMap = Maps.newHashMap();
     for (Map.Entry<Integer, Literal<?>> entry : map.entrySet()) {
-      bufferMap.put(entry.getKey(),
+      bufferMap.put(
+          entry.getKey(),
           Conversions.toByteBuffer(schema.findType(entry.getKey()), 
entry.getValue().value()));
     }
     return bufferMap;
   }
+
+  public static boolean isFixedLengthDecimal(ColumnDescriptor desc) {
+    PrimitiveType primitive = desc.getPrimitiveType();
+    return primitive.getOriginalType() != null &&
+        primitive.getOriginalType() == OriginalType.DECIMAL &&
+        (primitive.getPrimitiveTypeName() == 
PrimitiveType.PrimitiveTypeName.FIXED_LEN_BYTE_ARRAY ||
+            primitive.getPrimitiveTypeName() == 
PrimitiveType.PrimitiveTypeName.BINARY);
+  }
+
+  public static boolean isIntLongBackedDecimal(ColumnDescriptor desc) {
+    PrimitiveType primitive = desc.getPrimitiveType();
+    return primitive.getOriginalType() != null &&
+        primitive.getOriginalType() == OriginalType.DECIMAL &&
+        (primitive.getPrimitiveTypeName() == 
PrimitiveType.PrimitiveTypeName.INT64 ||
+            primitive.getPrimitiveTypeName() == 
PrimitiveType.PrimitiveTypeName.INT32);
+  }
+
+  public static boolean isVarWidthType(ColumnDescriptor desc) {
+    PrimitiveType primitive = desc.getPrimitiveType();
+    OriginalType originalType = primitive.getOriginalType();
+    if (originalType != null &&
+        originalType != OriginalType.DECIMAL &&
+        (originalType == OriginalType.ENUM ||
+            originalType == OriginalType.JSON ||
+            originalType == OriginalType.UTF8 ||
+            originalType == OriginalType.BSON)) {
 
 Review comment:
   Since `OriginalType` is an enum, it would be better to use a `switch` 
statement for these cases, unless it is a single value that you're testing 
(like `BINARY` below).

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to