pithecuse527 commented on code in PR #2367:
URL: https://github.com/apache/fluss/pull/2367#discussion_r2734582578
##########
fluss-lake/fluss-lake-iceberg/src/test/java/org/apache/fluss/lake/iceberg/flink/FlinkUnionReadLogTableITCase.java:
##########
@@ -330,6 +331,17 @@ private List<Row> writeFullTypeRows(
List<InternalRow> rows = new ArrayList<>();
List<Row> flinkRows = new ArrayList<>();
for (int i = 0; i < rowCount; i++) {
+ // Map for Fluss InternalRow
+ java.util.HashMap<Object, Object> mapData = new
java.util.HashMap<>();
Review Comment:
it's done 👍
##########
fluss-lake/fluss-lake-iceberg/src/test/java/org/apache/fluss/lake/iceberg/source/IcebergRecordAsFlussRowTest.java:
##########
@@ -195,4 +202,57 @@ void testNestedRow() {
assertThat(deepNestedRow.getString(0).toString()).isEqualTo(subfield1Value);
assertThat(deepNestedRow.getInt(1)).isEqualTo(subfield2Value);
}
+
+ @Test
+ void testMapType() {
+ // Create a simple map with String keys and Integer values
+ Map<String, Integer> mapData = new HashMap<>();
+ mapData.put("key1", 100);
+ mapData.put("key2", 200);
+ mapData.put("key3", 300);
+
+ record.setField("id", 1L);
+ record.setField("map_field", mapData);
+ // System columns
+ record.setField("__bucket", 1);
+ record.setField("__offset", 100L);
+ record.setField("__timestamp", OffsetDateTime.now(ZoneOffset.UTC));
+
+ icebergRecordAsFlussRow.replaceIcebergRecord(record);
+
+ // Test map retrieval - map_field is at index 14
+ org.apache.fluss.row.InternalMap internalMap =
icebergRecordAsFlussRow.getMap(14);
+ assertThat(internalMap).isNotNull();
+ assertThat(internalMap.size()).isEqualTo(3);
+
+ // Verify map contents by iterating through keys and values
+ org.apache.fluss.row.InternalArray keyArray = internalMap.keyArray();
+ org.apache.fluss.row.InternalArray valueArray =
internalMap.valueArray();
+
+ Map<String, Integer> resultMap = new HashMap<>();
+ for (int i = 0; i < internalMap.size(); i++) {
+ String key = keyArray.getString(i).toString();
+ int value = valueArray.getInt(i);
+ resultMap.put(key, value);
+ }
+
+ assertThat(resultMap).containsEntry("key1", 100);
+ assertThat(resultMap).containsEntry("key2", 200);
+ assertThat(resultMap).containsEntry("key3", 300);
+ }
+
+ @Test
+ void testNullMapType() {
Review Comment:
it's also done
--
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]