The issue arises while serializing the {column: column types} pair, the result returned is not in a constant order. This is because result is a JSONObject which internally uses HashMap and doesn’t maintain order.
Due to this, validating the jsonStr with another string doesn’t turn out to return true.
The fix is to modify the assert statements in a way to check only the presence of the individual key-value pair and ignore the order.
REPRODUCE:
This was found by using the NonDex tool.
What is the purpose of the change: To address the validation issue created due to the potential variations in String ordering during comparison.
This PR aims to fix two tests:
REASON AND FIX:
The issue arises while serializing the {column: column types} pair, the
result
returned is not in a constant order. This is becauseresult
is a JSONObject which internally uses HashMap and doesn’t maintain order.https://github.com/rcongiu/Hive-JSON-Serde/blob/7a05e91bf80a781da30cc69e2f5698b78f5b3397/json-serde/src/main/java/org/openx/data/jsonserde/JsonSerDe.java#L265
Due to this, validating the jsonStr with another string doesn’t turn out to return true. The fix is to modify the assert statements in a way to check only the presence of the individual key-value pair and ignore the order.
REPRODUCE: This was found by using the NonDex tool.