gemini-code-assist[bot] commented on code in PR #38865:
URL: https://github.com/apache/beam/pull/38865#discussion_r3398545680
##########
sdks/java/core/src/test/java/org/apache/beam/sdk/util/RowJsonTest.java:
##########
@@ -244,6 +247,21 @@ private static Object[] makeNullsTestCase() {
return new Object[] {"Nulls", schema, rowString, expectedRow};
}
+ private static Object[] makeMapFieldTestCase() {
+ Schema schema =
+ Schema.builder().addMapField("f_map", FieldType.STRING,
FieldType.INT32).build();
+
+ String rowString = "{\n" + "\"f_map\" : {\"key1\": 1, \"key2\": 2}\n" +
"}";
+
+ Map<String, Integer> expectedMap = new HashMap<>();
+ expectedMap.put("key1", 1);
+ expectedMap.put("key2", 2);
Review Comment:

Using `HashMap` does not guarantee a deterministic iteration order for the
map keys. If the serialization test compares the generated JSON string
directly, this can lead to flaky tests depending on the JVM implementation or
map size.
Consider using `ImmutableMap` to ensure a deterministic order of keys during
serialization.
```suggestion
Map<String, Integer> expectedMap = ImmutableMap.of("key1", 1, "key2",
2);
```
--
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]