ayushtkn commented on code in PR #14974:
URL: https://github.com/apache/iceberg/pull/14974#discussion_r2665350423
##########
data/src/test/java/org/apache/iceberg/data/TestGenericRecord.java:
##########
@@ -83,4 +86,35 @@ public void testDeepCopyValues() {
assertThat(copy.getField(field.name())).isNotSameAs(original.getField(field.name()));
}
}
+
+ @Test
+ public void testInternalRecordWrapperWithTimestampNano() {
Review Comment:
I did try writing one, but the child class Spark says the type isn't
supported and the flink one
```
diff --git
a/data/src/test/java/org/apache/iceberg/RecordWrapperTestBase.java
b/data/src/test/java/org/apache/iceberg/RecordWrapperTestBase.java
index f51d1ebed..ef6ec9cb8 100644
--- a/data/src/test/java/org/apache/iceberg/RecordWrapperTestBase.java
+++ b/data/src/test/java/org/apache/iceberg/RecordWrapperTestBase.java
@@ -52,6 +52,11 @@ public abstract class RecordWrapperTestBase {
required(101, "ts0", Types.TimestampType.withoutZone()),
required(102, "ts1", Types.TimestampType.withoutZone()));
+ private static final Types.StructType TIMESTAMP_NS_WITHOUT_ZONE =
+ Types.StructType.of(
+ required(101, "ts0", Types.TimestampNanoType.withoutZone()),
+ required(102, "ts1", Types.TimestampNanoType.withoutZone()));
+
protected static final Types.StructType TIME =
Types.StructType.of(
required(100, "time0", Types.TimeType.get()),
@@ -67,6 +72,11 @@ public abstract class RecordWrapperTestBase {
generateAndValidate(new Schema(TIMESTAMP_WITHOUT_ZONE.fields()));
}
+ @Test
+ public void testTimestampNaNoWithoutZone() {
+ generateAndValidate(new Schema(TIMESTAMP_NS_WITHOUT_ZONE.fields()));
+ }
+
@Test
public void testTime() {
generateAndValidate(new Schema(TIME.fields()));
```
And the Flink return something different, I started debugging bit on flink
side:
```
TestRowDataWrapper > testTimestampNaNoWithoutZone() FAILED
java.lang.AssertionError: StructLike mismatch detected
Field [0] name=ts0 type=timestamp_ns
expected=org.apache.iceberg.flink.RowDataWrapper@16423501
(org.apache.iceberg.flink.RowDataWrapper)
actual =org.apache.iceberg.data.InternalRecordWrapper@4efcf8a
(org.apache.iceberg.data.InternalRecordWrapper)
Field [1] name=ts1 type=timestamp_ns
expected=org.apache.iceberg.flink.RowDataWrapper@16423501
(org.apache.iceberg.flink.RowDataWrapper)
actual =org.apache.iceberg.data.InternalRecordWrapper@4efcf8a
(org.apache.iceberg.data.InternalRecordWrapper)
at
org.apache.iceberg.flink.TestRowDataWrapper.generateAndValidate(TestRowDataWrapper.java:119)
```
I added bit more assertions, it returns `RowDataWrapper`
I was trying on Hive & it was failing with same exception while creating a
`GenericRecord`, So I added it here, It didn't had any Hive child class,
Let me know if I missed something or did something wrong
--
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]