[SPARK-40815][SQL][FOLLOW-UP] Fix record reader in DelegateSymlinkTextInputFormat to avoid Hive ExecMapper.getDone() check#38544
Closed
sadikovi wants to merge 2 commits intoapache:masterfrom
Closed
Conversation
Contributor
Author
|
@dongjoon-hyun @sunchao Could you review this PR? Thank you. This is my attempt at fixing the test (and the code) in JDK 11. |
Contributor
Author
|
cc @cloud-fan as well. Let me know if there are concerns with this approach. |
cloud-fan
approved these changes
Nov 10, 2022
Contributor
|
thanks, merging to master! |
|
Can one of the admins verify this patch? |
Contributor
Author
|
Thank you. |
SandishKumarHN
pushed a commit
to SandishKumarHN/spark
that referenced
this pull request
Dec 12, 2022
…tInputFormat to avoid Hive ExecMapper.getDone() check ### What changes were proposed in this pull request? Follow-up for apache#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 around `getDone()` or `setDone()`, 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. Closes apache#38544 from sadikovi/fix-symlink-test-2. Authored-by: Ivan Sadikov <ivan.sadikov@databricks.com> Signed-off-by: Wenchen Fan <wenchen@databricks.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.