[SPARK-40815][SQL][FOLLOW-UP] Fix record reader in DelegateSymlinkTextInputFormat to avoid Hive ExecMapper.getDone() check #38544
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.
What changes were proposed in this pull request?
Follow-up for #38504.
This PR fixes an issue where a unit test for SymlinkTextInputFormat would fail in JDK 11. The fix is to return the record reader directly instead of wrapping it with
HiveRecordReader.The issue could be reproduced by running a test right before SPARK-40815 tests with JDK 11 and appears to be related to
ExecMapper.getDone()(https://github.com/apache/hive/blob/branch-2.3/ql/src/java/org/apache/hadoop/hive/ql/io/HiveRecordReader.java#L76). This check is for a static variable that is set when the map job is done to limit results. Note that there is no synchronisation aroundgetDone()orsetDone(), it is just a static mutable variable.Once that is set, the record reader returns 0 records. I don't know why it works in JDK 8 but not in JDK 11 but my current suspicion is something related to class loader in JDK similar to this patch: apache/hive@a234475 (maybe this is the fix but I was not able to verify).
Why are the changes needed?
Re-enables the test and fixes an issue with DelegateSymlinkTextInputFormat returning 0 records. Note that this is still an issue with SymlinkTextInputFormat as this needs to be addressed in Hive.
Does this PR introduce any user-facing change?
No.
How was this patch tested?
I re-enabled the unit tests that used to fail in JDK 11 and extended a test to cover LIMIT.