Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed two tests in JsonSerDeTest #241

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

Sujishark
Copy link

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:

org.openx.data.jsonserde.JsonSerDeTest.testNestedExplicitNullValue
org.openx.data.jsonserde.JsonSerDeTest.testExplicitNullValue

REASON AND FIX:

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.

cd Hive-JSON-Serde
mvn install -pl json-serde -am -DskipTests
mvn -pl json-serde edu.illinois:nondex-maven-plugin:2.1.1:nondex -Dtest=org.openx.data.jsonserde.JsonSerDeTest#testNestedExplicitNullValue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant