forked from apache/spark
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SPARK-45488][SQL] XML: Add support for value in 'rowTag' element
### What changes were proposed in this pull request? The following XML with rowTag 'book' will yield a schema with just "_id" column and not the value: ``` <p><book id="1">Great Book</book> </p> ``` Let's parse value as well. The scope of this PR is to keep the rowTag's behavior of `valueTag` consistent with the inner objects. ### Why are the changes needed? The semantics for attributes and `valueTag` should be consistent ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? Unit test ### Was this patch authored or co-authored using generative AI tooling? No Closes apache#43319 from shujingyang-db/rootlevel-valuetag. Lead-authored-by: Shujing Yang <shujing.yang@databricks.com> Co-authored-by: Shujing Yang <135740748+shujingyang-db@users.noreply.github.com> Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>
- Loading branch information
1 parent
5a00631
commit e69752a
Showing
5 changed files
with
123 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
8 changes: 8 additions & 0 deletions
8
sql/core/src/test/resources/test-data/xml-resources/root-level-value-none.xml
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0"?> | ||
<ROWSET> | ||
<ROW>value1</ROW> | ||
<ROW attr="attr1">value2</ROW> | ||
<ROW>4<tag>5</tag></ROW> | ||
<ROW><tag>6</tag>7</ROW> | ||
<ROW attr="8"></ROW> | ||
</ROWSET> |
9 changes: 9 additions & 0 deletions
9
sql/core/src/test/resources/test-data/xml-resources/root-level-value.xml
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?xml version="1.0"?> | ||
<ROWSET> | ||
<ROW>value1</ROW> | ||
<ROW attr="attr1">value2</ROW> | ||
<ROW> | ||
value3 | ||
<!-- this is a comment--> | ||
</ROW> | ||
</ROWSET> |
This file contains 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