suvodeep-pyne commented on code in PR #16843:
URL: https://github.com/apache/pinot/pull/16843#discussion_r2356968180
##########
pinot-core/src/test/java/org/apache/pinot/core/segment/processing/genericrow/GenericRowSerDeTest.java:
##########
@@ -136,4 +146,87 @@ public void testCompare() {
assertEquals(deserializer.compare(0L, numBytes, i), 0);
}
}
+
+ @Test
+ public void testMapSerDe() {
+ List<FieldSpec> mapFieldSpecs = Arrays.asList(new
ComplexFieldSpec("mapSV", DataType.MAP, true, new HashMap<>()));
+
+ GenericRow mapRow = new GenericRow();
+ Map<String, Object> testMap = new HashMap<>();
+ testMap.put("stringKey", "stringValue");
+ testMap.put("intKey", 123);
+ testMap.put("doubleKey", 45.67);
+ mapRow.putValue("mapSV", testMap);
+
+ GenericRowSerializer serializer = new GenericRowSerializer(mapFieldSpecs,
false);
+ byte[] bytes = serializer.serialize(mapRow);
+ PinotDataBuffer dataBuffer = PinotDataBuffer.allocateDirect(bytes.length,
PinotDataBuffer.NATIVE_ORDER, null);
+ dataBuffer.readFrom(0L, bytes);
+ GenericRowDeserializer deserializer = new
GenericRowDeserializer(dataBuffer, mapFieldSpecs, false);
+ GenericRow buffer = new GenericRow();
+ deserializer.deserialize(0L, buffer);
+
+ @SuppressWarnings("unchecked")
+ Map<String, Object> deserializedMap = (Map<String, Object>)
buffer.getValue("mapSV");
+ assertEquals(deserializedMap, testMap);
+ }
+
+ @Test
+ public void testMapCompare() {
Review Comment:
A consistency test might be if `compare(m1, m2) > 0` is it consistent that
`compare(m2, m1) < 0` must be true. and it cannot be equal either.
--
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]