wmoustafa commented on code in PR #6004:
URL: https://github.com/apache/iceberg/pull/6004#discussion_r1179976491
##########
data/src/test/java/org/apache/iceberg/data/DataTestHelpers.java:
##########
@@ -88,6 +90,16 @@ private static void assertEquals(Type type, Object expected,
Object actual) {
"Primitive value should be equal to expected for type " + type,
expected, actual);
break;
case FIXED:
+ // For fixed type, Iceberg actually represent value as Bytebuffer,
+ // but since RandomGenericData generates bytearray data for fixed type
+ // for it to be written to Avro, we add a conversion here to make the
+ // equality comparison consistent using bytearray
+ if (expected instanceof ByteBuffer) {
+ expected = ByteBuffers.toByteArray((ByteBuffer) expected);
+ }
+ if (actual instanceof ByteBuffer) {
+ actual = ByteBuffers.toByteArray((ByteBuffer) actual);
Review Comment:
If we keep `SingleValueParser` and `DataTestHelpers` without any change, the
error is:
```
org.apache.iceberg.data.avro.TestReadDefaultValues > writeAndValidate FAILED
java.lang.AssertionError: [Expected should be a byte[]]
Expecting actual:
java.nio.HeapByteBuffer[pos=0 lim=2 cap=2]
to be an instance of:
byte[]
but was instance of:
java.nio.HeapByteBuffer
at
org.apache.iceberg.data.DataTestHelpers.assertEquals(DataTestHelpers.java:93)
at
org.apache.iceberg.data.DataTestHelpers.assertEquals(DataTestHelpers.java:39)
at
org.apache.iceberg.data.avro.TestReadDefaultValues.writeAndValidate(TestReadDefaultValues.java:164)
```
--
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]