RITIKHARIANI opened a new pull request, #5765:
URL: https://github.com/apache/hive/pull/5765

   
   ### What changes were proposed in this pull request?
   
   This pull request addresses non-deterministic behavior in the 
`TestLazyBinaryColumnarSerDe#testLazyBinaryColumnarSerDeWithEmptyBinary` test 
and other related tests. The root cause of the intermittent failures was 
identified in `ObjectInspectorUtils.java`, where the method 
`getDeclaredFields()` was used. The `getDeclaredFields()` method returns fields 
in an unordered manner, which can cause inconsistent results across different 
JVM versions and vendors. This PR resolves the issue by sorting the fields 
retrieved by `getDeclaredFields()` to ensure consistent behavior across JVMs.
   
   ### Why are the changes needed?
   
   The `getDeclaredFields()` method does not guarantee a specific order in the 
returned fields, which can vary depending on the JVM version and vendor. This 
non-deterministic behavior caused test cases, such as 
`TestLazyBinaryColumnarSerDe#testLazyBinaryColumnarSerDeWithEmptyBinary`, to 
fail intermittently. By sorting the fields, we ensure deterministic behavior, 
thus resolving the root cause of these test failures.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No, this PR does not introduce any user-facing changes. The changes are 
internal, aimed at stabilizing the behavior of the code and ensuring that tests 
pass consistently across environments.
   
   ### Is the change a dependency upgrade?
   
   No, this PR does not involve any dependency upgrades. It focuses solely on 
addressing the non-deterministic behavior in the current codebase.
   
   ### How was this patch tested?
   
   The patch was tested by running the affected test cases, particularly 
`TestLazyBinaryColumnarSerDe#testLazyBinaryColumnarSerDeWithEmptyBinary`, using 
the `NonDex` tool. This tool helps detect and debug issues with 
under-determined Java APIs. The sorting of fields was confirmed to prevent 
non-deterministic behavior, and the tests were verified to pass consistently. 
   
   To replicate the testing steps:
   
   1. Clone the repository and run `mvn install`.
   2. Navigate to the `hive/serde` directory.
   3. Run the following command to test the patch:
   
   ```bash
   cd hive/serde
   mvn edu.illinois:nondex-maven-plugin:2.1.7:nondex 
-Dtest=TestLazyBinaryColumnarSerDe#testLazyBinaryColumnarSerDeWithEmptyBinary 
-DnondexMode=FULL -DnondexRuns=10
   


-- 
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: gitbox-unsubscr...@hive.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org
For additional commands, e-mail: gitbox-h...@hive.apache.org

Reply via email to