[SPARK-48148][FOLLOWUP] Fix JSON parser feature flag. #49018
Closed
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?
#46408 attempts to set the feature flag
INCLUDE_SOURCE_IN_LOCATIONin the JSON parser and reverts the flag to the original value. The reverting code is incorrect and accidentally sets theAUTO_CLOSE_SOURCEfeature to false. The reason is thatoverrideStdFeatures(value, mask)sets the feature flags selected bymasktovalue.originalMaskis a value of 0/1. When it is 1, it selectsAUTO_CLOSE_SOURCE, whose ordinal is 0 (reference). The old code doesn't revertINCLUDE_SOURCE_IN_LOCATIONto the original value either. As a result, when the JSON parser is closed, the underlying input stream is not closed, which can lead to memory leak.Why are the changes needed?
Perform the originally intended feature, and avoid memory leak.
Does this PR introduce any user-facing change?
No.
How was this patch tested?
New unit test. It would fail without the change in the PR.
Was this patch authored or co-authored using generative AI tooling?
No.