pvary commented on code in PR #15795:
URL: https://github.com/apache/iceberg/pull/15795#discussion_r3354882517


##########
data/src/test/java/org/apache/iceberg/data/BaseFormatModelTests.java:
##########
@@ -1803,41 +1899,66 @@ private static void assertBounds(
 
     Map<Integer, ByteBuffer> lowerBounds = file.lowerBounds();
     Map<Integer, ByteBuffer> upperBounds = file.upperBounds();
+    if (genericRecords.isEmpty()) {
+      return;
+    }
+    Types.StructType recordStruct = genericRecords.get(0).struct();
+    InternalRecordWrapper wrapper = new InternalRecordWrapper(recordStruct);
+    List<Types.NestedField> recordFields = recordStruct.fields();
     for (Types.NestedField field : schema.columns()) {
-      if (field.type().isPrimitiveType()) {
-        assertThat(lowerBounds).containsKey(field.fieldId());
-        assertThat(upperBounds).containsKey(field.fieldId());
-
-        ByteBuffer lowerBuffer = lowerBounds.get(field.fieldId());
-        ByteBuffer upperBuffer = upperBounds.get(field.fieldId());
+      if (!field.type().isPrimitiveType()) {
+        continue;
+      }
 
-        Comparator<Object> cmp = 
Comparators.forType(field.type().asPrimitiveType());
+      assertThat(lowerBounds).containsKey(field.fieldId());
+      assertThat(upperBounds).containsKey(field.fieldId());
 
-        Object[] minMax = computeMinMax(genericRecords, field, cmp);
-        Object expectedMin = minMax[0];
-        Object expectedMax = minMax[1];
+      // String bounds may be truncated by the writer; skip value comparison.
+      if (field.type().typeId() == Type.TypeID.STRING) {
+        continue;
+      }

Review Comment:
   Could we still check the bounds based on the length of the min/max?



-- 
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