yusufyildiz34 commented on code in PR #18508:
URL: https://github.com/apache/iceberg/pull/18508#discussion_r4287889429


##########
flink/v2.3/flink/src/test/java/org/apache/iceberg/flink/TestRowDataWrapper.java:
##########
@@ -91,4 +105,86 @@ protected void generateAndValidate(
     assertThat(actual).isExhausted();
     assertThat(expected).isExhausted();
   }
+
+  @Test
+  void listElementsAreConverted() {
+    Schema schema =
+        new Schema(
+            Types.NestedField.optional(
+                1, "tags", Types.ListType.ofOptional(2, 
Types.StringType.get())));
+    RowData row =
+        GenericRowData.of(new GenericArrayData(new Object[] 
{StringData.fromString("a"), null}));
+
+    assertThat(wrap(schema, row).get(0, List.class)).containsExactly("a", 
null);
+  }
+
+  @Test
+  void listOfTimestampsIsConvertedToMicros() {
+    Schema schema =
+        new Schema(
+            Types.NestedField.optional(
+                1, "times", Types.ListType.ofOptional(2, 
Types.TimestampType.withoutZone())));
+    LocalDateTime time = LocalDateTime.of(2026, 10, 14, 12, 30, 45, 
123_456_000);
+    RowData row =
+        GenericRowData.of(
+            new GenericArrayData(new Object[] 
{TimestampData.fromLocalDateTime(time)}));
+
+    assertThat(wrap(schema, row).get(0, List.class))
+        .containsExactly(DateTimeUtil.microsFromTimestamp(time));
+  }
+
+  @Test
+  void listOfStructsHasIndependentElements() {
+    Schema schema =
+        new Schema(
+            Types.NestedField.optional(
+                1,
+                "points",
+                Types.ListType.ofOptional(
+                    2,
+                    Types.StructType.of(
+                        Types.NestedField.required(3, "x", 
Types.IntegerType.get())))));
+    RowData row =
+        GenericRowData.of(
+            new GenericArrayData(new Object[] {GenericRowData.of(1), 
GenericRowData.of(2)}));
+
+    List<?> points = wrap(schema, row).get(0, List.class);
+    assertThat(points).hasSize(2);
+    assertThat(((StructLike) points.get(0)).get(0, 
Integer.class)).isEqualTo(1);
+    assertThat(((StructLike) points.get(1)).get(0, 
Integer.class)).isEqualTo(2);
+  }
+
+  @Test
+  void listOfUnknownElements() {
+    Schema schema =
+        new Schema(
+            Types.NestedField.optional(
+                1, "unknowns", Types.ListType.ofOptional(2, 
Types.UnknownType.get())));
+    RowData row = GenericRowData.of(new GenericArrayData(new Object[] {null}));
+
+    assertThat(wrap(schema, row).get(0, List.class)).containsExactly((Object) 
null);
+  }
+
+  @Test
+  void mapKeysAndValuesAreConverted() {
+    Schema schema =
+        new Schema(
+            Types.NestedField.optional(
+                1,
+                "prices",
+                Types.MapType.ofOptional(
+                    2, 3, Types.StringType.get(), Types.DecimalType.of(9, 
2))));
+    BigDecimal price = new BigDecimal("1.50");
+    RowData row =
+        GenericRowData.of(
+            new GenericMapData(
+                ImmutableMap.of(
+                    StringData.fromString("a"), 
DecimalData.fromBigDecimal(price, 9, 2))));
+
+    assertThat(wrap(schema, row).get(0, 
Map.class)).isEqualTo(ImmutableMap.of("a", price));
+  }

Review Comment:
   Added `emptyListIsConverted`, `mapNullValueIsPreserved`, and 
`nestedListIsConverted` for those three paths. I also added 
`nestedStructsInListElementsAreIndependent`, which caught a bug in my first 
version of the getter sharing; details in the buildGetter thread.



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