You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR fixes a flaky test called TestLazyBinaryColumnarSerDe.testSerDe which can be found here.
How was this test identified as flaky?
This test was identifies as flaky by using an open-source research tool named NonDex which is responsible for finding and diagnosing non-deterministic runtime exceptions in Java programs.
What does this test do?
This test is responsible for testing serialization and deserialization of data using a specific implementation called LazyBinaryColumnarSerDe. This test is used to ensure that the serialization and deserialization of an object of type OuterStruct works correctly.
Why this test is flaky?
This test is flaky as there is an order mismatch between the different fields of the object inspector oi in the serialization process.
Specifically, there is a mismatch between the field f and the field object inspector foi during serialization causing the field to be serialized using the incorrect field object inspector which results in a java.lang.ClassCastException.
In the above code, we are using the Arrays.sort method to sort the array f using a custom comparator. In this comparator, we try to get a reference to the private field named slot in the class Field using reflection. We then set it to be accessible and retrieve the value of the field slot for the current object and return it as an integer. In the event that, there is an error with the reflection or if the slot field does not exist, we catch it and print the stack trace. In case of an exception, we return 0 to ensure that we provide a fallback value that allows the program to continue executing.
You can run the following command to run the test using NonDex tool:
First of all, I think you need to explicitly state in the PR why the flaky is generated and the error code that reports the error. Just listing the nondex code used and the line of code in question doesn't make it easy for someone to know what went wrong and the details of the specific problem.
Secondly, you should explain in the PR why you made the changes you did, e.g. why you used a try-catch and why it should return 0 if there is an error.
The code you fixed may be valid, but a non-detailed PR description may cause your PR to be rejected.
You can proceed to open a real PR. Once you open a real PR, please mark this tentative PR as Opened in your tentative_pr.csv file and also raise a PR to IDoFT marking this as Opened. Thanks!
The PR looks good, following are a few suggestions:
Created this PR to fix a flaky test called TestLazyBinaryColumnarSerDe.testSerDe which can be found in the path:
hive/serde/src/test/org/apache/hadoop/hive/serde2/columnar/TestLazyBinaryColumnarSerDe.java -> This PR fixes a flaky test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes a flaky test called
TestLazyBinaryColumnarSerDe.testSerDewhich can be found here.This test was identifies as flaky by using an open-source research tool named NonDex which is responsible for finding and diagnosing non-deterministic runtime exceptions in Java programs.
This test is responsible for testing serialization and deserialization of data using a specific implementation called LazyBinaryColumnarSerDe. This test is used to ensure that the serialization and deserialization of an object of type
OuterStructworks correctly.This test is flaky as there is an order mismatch between the different fields of the object inspector
oiin the serialization process.The error occurs here:
hive/serde/src/test/org/apache/hadoop/hive/serde2/columnar/TestLazyBinaryColumnarSerDe.java
Line 104 in acbfca7
Specifically, there is a mismatch between the field
fand the field object inspectorfoiduring serialization causing the field to be serialized using the incorrect field object inspector which results in ajava.lang.ClassCastException.hive/serde/src/java/org/apache/hadoop/hive/serde2/columnar/LazyBinaryColumnarSerDe.java
Line 119 in acbfca7
This PR fixes this error by sorting the fields of the object inspector
oibased on theslotproperty.The field list is sorted here:
hive/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/ObjectInspectorUtils.java
Line 562 in acbfca7
In the above code, we are using the Arrays.sort method to sort the array f using a custom comparator. In this comparator, we try to get a reference to the private field named
slotin the classFieldusing reflection. We then set it to be accessible and retrieve the value of the fieldslotfor the current object and return it as an integer. In the event that, there is an error with the reflection or if theslotfield does not exist, we catch it and print the stack trace. In case of an exception, we return 0 to ensure that we provide a fallback value that allows the program to continue executing.You can run the following command to run the test using NonDex tool:
(Optional) You can also run the following command to run the test:
Test Environment: