anoopj commented on code in PR #16006:
URL: https://github.com/apache/iceberg/pull/16006#discussion_r3101209907


##########
arrow/src/test/java/org/apache/iceberg/arrow/vectorized/TestArrowReader.java:
##########
@@ -383,6 +384,68 @@ public void testTimestampMillisAreReadCorrectly() throws 
Exception {
     assertThat(totalRowsRead).as("Should read all 
rows").isEqualTo(millisValues.size());
   }
 
+  @Test
+  public void testUnsignedIntegerColumnThrowsException() throws Exception {
+    tables = new HadoopTables();
+
+    for (int[] spec : new int[][] {{8, 32}, {16, 32}, {32, 32}, {64, 64}}) {

Review Comment:
   Use a `@ParameterizedTest` instead of this loop such that we get better 
error messages if there are test failures. 



##########
arrow/src/main/java/org/apache/iceberg/arrow/vectorized/VectorizedArrowReader.java:
##########
@@ -584,6 +584,15 @@ public Optional<LogicalTypeVisitorResult> visit(
     @Override
     public Optional<LogicalTypeVisitorResult> visit(
         LogicalTypeAnnotation.IntLogicalTypeAnnotation intLogicalType) {
+      if (!intLogicalType.isSigned()) {
+        throw new UnsupportedOperationException(
+            String.format(
+                java.util.Locale.ROOT,

Review Comment:
   Minor: Import java.util.locale package and then reference `ROOT`, to be 
consistent. 



##########
arrow/src/test/java/org/apache/iceberg/arrow/vectorized/TestArrowReader.java:
##########
@@ -383,6 +384,68 @@ public void testTimestampMillisAreReadCorrectly() throws 
Exception {
     assertThat(totalRowsRead).as("Should read all 
rows").isEqualTo(millisValues.size());
   }
 
+  @Test
+  public void testUnsignedIntegerColumnThrowsException() throws Exception {
+    tables = new HadoopTables();
+
+    for (int[] spec : new int[][] {{8, 32}, {16, 32}, {32, 32}, {64, 64}}) {
+      int unsignedBitWidth = spec[0];
+      int physicalBitWidth = spec[1];
+      PrimitiveType.PrimitiveTypeName physicalType =
+          physicalBitWidth == 32
+              ? PrimitiveType.PrimitiveTypeName.INT32
+              : PrimitiveType.PrimitiveTypeName.INT64;
+
+      Schema schema = new Schema(Types.NestedField.optional(1, "col", 
Types.IntegerType.get()));
+      Table table = tables.create(schema, tempDir.toURI() + "/uint" + 
unsignedBitWidth);
+
+      MessageType parquetSchema =
+          new MessageType(
+              "test",
+              primitive(physicalType, Type.Repetition.OPTIONAL)
+                  .as(LogicalTypeAnnotation.intType(unsignedBitWidth, false))
+                  .id(1)
+                  .named("col"));
+
+      File testFile = new File(tempDir, "unsigned-int" + unsignedBitWidth + 
".parquet");

Review Comment:
   Minor: Generally a good idea to do append a `System.nanoTime()` to temp file 
names created in tests to guarantee uniqueness



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to