Copilot commented on code in PR #2308:
URL: https://github.com/apache/fluss/pull/2308#discussion_r2661373087


##########
fluss-lake/fluss-lake-paimon/src/test/java/org/apache/fluss/lake/paimon/source/FlussRowAsPaimonRowTest.java:
##########
@@ -333,4 +337,151 @@ void testArrayWithAllTypes() {
         InternalArray innerArray2 = outerArray.getArray(1);
         assertThat(innerArray2.toIntArray()).isEqualTo(new int[] {3, 4, 5});
     }
+
+    @Test
+    void testMapTypeWithIntegerKeyValue() {
+        RowType tableRowType =
+                RowType.of(
+                        new org.apache.paimon.types.MapType(
+                                new org.apache.paimon.types.IntType(),
+                                new org.apache.paimon.types.IntType()));
+
+        long logOffset = 0;
+        long timeStamp = System.currentTimeMillis();
+        GenericRow genericRow = new GenericRow(1);
+        Map<Object, Object> mapData = new HashMap<>();
+        mapData.put(1, 100);
+        mapData.put(2, 200);
+        mapData.put(3, 300);
+        genericRow.setField(0, new GenericMap(mapData));
+
+        LogRecord logRecord = new GenericRecord(logOffset, timeStamp, 
APPEND_ONLY, genericRow);
+        FlussRowAsPaimonRow flussRowAsPaimonRow =
+                new FlussRowAsPaimonRow(logRecord.getRow(), tableRowType);
+
+        InternalMap map = flussRowAsPaimonRow.getMap(0);
+        assertThat(map).isNotNull();
+        assertThat(map.size()).isEqualTo(3);
+
+        InternalArray keys = map.keyArray();
+        InternalArray values = map.valueArray();
+        assertThat(keys.size()).isEqualTo(3);
+        assertThat(values.size()).isEqualTo(3);
+    }

Review Comment:
   Similar to the tiering tests, these test methods only verify the size of the 
maps but don't assert the actual content of the keys and values. For example, 
in testMapTypeWithIntegerKeyValue, after getting the keys and values arrays, 
the test should verify that the arrays contain the expected data (e.g., keys 
contain 1, 2, 3 and values contain 100, 200, 300). This would ensure the data 
conversion is working correctly end-to-end.



##########
fluss-lake/fluss-lake-paimon/src/test/java/org/apache/fluss/lake/paimon/tiering/FlussRecordAsPaimonRowTest.java:
##########
@@ -822,4 +826,299 @@ void testNestedRowType() {
         assertThat(flussRecordAsPaimonRow.getLong(9)).isEqualTo(logOffset);
         assertThat(flussRecordAsPaimonRow.getLong(10)).isEqualTo(timeStamp);
     }
+
+    @Test
+    void testMapTypeWithIntegerKeyValue() {
+        int tableBucket = 0;
+        RowType tableRowType =
+                RowType.of(
+                        new org.apache.paimon.types.MapType(
+                                new org.apache.paimon.types.IntType(),
+                                new org.apache.paimon.types.IntType()),
+                        // system columns
+                        new org.apache.paimon.types.IntType(),
+                        new org.apache.paimon.types.BigIntType(),
+                        new 
org.apache.paimon.types.LocalZonedTimestampType(3));
+
+        FlussRecordAsPaimonRow flussRecordAsPaimonRow =
+                new FlussRecordAsPaimonRow(tableBucket, tableRowType);
+        long logOffset = 0;
+        long timeStamp = System.currentTimeMillis();
+        GenericRow genericRow = new GenericRow(1);
+        Map<Object, Object> mapData = new HashMap<>();
+        mapData.put(1, 100);
+        mapData.put(2, 200);
+        mapData.put(3, 300);
+        genericRow.setField(0, new GenericMap(mapData));
+
+        LogRecord logRecord = new GenericRecord(logOffset, timeStamp, 
APPEND_ONLY, genericRow);
+        flussRecordAsPaimonRow.setFlussRecord(logRecord);
+
+        InternalMap map = flussRecordAsPaimonRow.getMap(0);
+        assertThat(map).isNotNull();
+        assertThat(map.size()).isEqualTo(3);
+
+        InternalArray keys = map.keyArray();
+        InternalArray values = map.valueArray();
+        assertThat(keys.size()).isEqualTo(3);
+        assertThat(values.size()).isEqualTo(3);
+    }

Review Comment:
   The test methods testMapTypeWithIntegerKeyValue, 
testMapTypeWithStringKeyIntValue, testNestedMapType, testMapWithComplexTypes, 
testMapInArray cover the basic functionality but don't verify the actual key 
and value contents retrieved from the InternalMap. The tests only assert the 
size of keys and values arrays but don't check if the actual data is correctly 
converted. Consider adding assertions to verify the actual key-value pairs are 
correctly accessible through the Paimon InternalMap interface, for example by 
checking specific key and value retrievals like keys.getInt(0), 
values.getInt(0), etc.



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

Reply via email to