[SPARK-57540][SQL] Instantiate Woodstox WstxOutputFactory directly in StaxXmlGenerator#56600
Open
gaogaotiantian wants to merge 1 commit into
Open
[SPARK-57540][SQL] Instantiate Woodstox WstxOutputFactory directly in StaxXmlGenerator#56600gaogaotiantian wants to merge 1 commit into
WstxOutputFactory directly in StaxXmlGenerator#56600gaogaotiantian wants to merge 1 commit into
Conversation
…in `StaxXmlGenerator` Construct the shaded `WstxOutputFactory` directly instead of resolving a StAX implementation via `XMLOutputFactory.newInstance()`, so the factory always matches the shaded `WstxOutputProperties` keys it is configured with. Co-authored-by: Isaac
sandip-db
approved these changes
Jun 19, 2026
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?
In
StaxXmlGenerator, the StAXXMLOutputFactorywas obtained viaXMLOutputFactory.newInstance()and then configured with Woodstox-specific properties from the shaded Hadoop Woodstox (org.apache.hadoop.shaded.com.ctc.wstx.api.WstxOutputProperties).This PR constructs the shaded Woodstox factory directly:
instead of relying on
XMLOutputFactory.newInstance().Why are the changes needed?
XMLOutputFactory.newInstance()resolves a concrete StAX implementation through the JAXP/service-loader lookup. If any other (unshaded) StAX provider happens to be on the classpath, it can win that lookup and return a factory that is not the shaded Woodstox. That factory does not understand the shadedWstxOutputProperties.P_OUTPUT_VALIDATE_STRUCTURE/P_OUTPUT_VALIDATE_NAMESkeys set immediately afterwards, and Woodstox/StAX throwsIllegalArgumentExceptionfor unknown property keys.By instantiating the shaded
WstxOutputFactorydirectly, the factory implementation and the property keys are guaranteed to come from the same shaded Woodstox, eliminating the potential conflict regardless of what else is on the classpath.Does this PR introduce any user-facing change?
No.
How was this patch tested?
Existing
to_xml/ XML write tests inXmlSuitecover this code path. No behavior change is expected; the factory used is the same shaded Woodstox that the configured properties already targeted.Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Opus 4.8)