Skip to content

[SPARK-45414][SQL][TESTS] Add regression tests for XML mixed type serialization#53857

Open
jdavidroberts wants to merge 4 commits intoapache:masterfrom
jdavidroberts:spark-45414-xml-tests
Open

[SPARK-45414][SQL][TESTS] Add regression tests for XML mixed type serialization#53857
jdavidroberts wants to merge 4 commits intoapache:masterfrom
jdavidroberts:spark-45414-xml-tests

Conversation

@jdavidroberts
Copy link

This adds two regression tests for SPARK-45414 to prevent reintroduction of the bug where string tag content was misplaced when writing XML with mixed column types (structs, arrays, and strings).

Tests verify:

  • String columns between and after nested types write correctly
  • Attributes mixed with string elements serialize properly

What changes were proposed in this pull request?

Add two regression tests for SPARK-45414 to prevent reintroduction of the bug where string tag content could be misplaced when writing XML with mixed column types.

Why are the changes needed?

SPARK-45414 reported a bug in the spark-xml library where string content was misplaced when writing structs with mixed types. While this bug was fixed during spark-xml integration into Spark core, there were no tests ensuring this specific scenario remains correct. These tests provide coverage for the bug scenario.

Does this PR introduce any user-facing change?

No, this only adds test coverage.

How was this patch tested?

The new tests were run successfully:

Was this patch authored or co-authored using generative AI tooling?

Yes, co-authored with Claude Sonnet 4.5.

Generated-by: Claude Sonnet 4.5

@github-actions github-actions bot added the SQL label Jan 19, 2026
@github-actions
Copy link

JIRA Issue Information

=== Bug SPARK-45414 ===
Summary: spark-xml misplaces string tag content
Assignee: None
Status: Open
Affected: ["3.3.0"]


This comment was automatically generated by GitHub Actions

@jdavidroberts
Copy link
Author

Hi @sandip-db @cloud-fan @dongjoon-hyun,

Would appreciate a review when you have time. This PR adds two regression tests for SPARK-45414 to ensure the XML string tag content placement bug doesn't reappear.

The bug was originally reported in the external spark-xml library and was fixed during integration into Spark core. These tests verify that:

  1. String columns mixed with nested types (structs, arrays) serialize correctly
  2. Attributes mixed with string elements are properly handled

The tests are straightforward roundtrip write/read verification with clear assertions. All tests pass locally and CI is green.

Thank you!

@cloud-fan
Copy link
Contributor

LGTM if CI is green, can you do a rebase?

jdavidroberts and others added 4 commits February 19, 2026 18:41
…ialization

This adds two regression tests for SPARK-45414 to prevent reintroduction
of the bug where string tag content was misplaced when writing XML with
mixed column types (structs, arrays, and strings).

Tests verify:
- String columns between and after nested types write correctly
- Attributes mixed with string elements serialize properly

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Sandip Agarwala <131817656+sandip-db@users.noreply.github.com>
@jdavidroberts jdavidroberts force-pushed the spark-45414-xml-tests branch 2 times, most recently from 4e8f342 to 4463e00 Compare February 20, 2026 02:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Comments