Commit 51d7a20
[SPARK-54306] Annotate Variant columns with Variant logical type annotation
### What changes were proposed in this pull request?
This PR makes changes to the parquet writer to make it annotate variant columns with the parquet variant logical type annotation.
### Why are the changes needed?
The Parquet spec has formally adopted the Variant logical type, and therefore, Variant columns must be properly annotated in Spark 4.1.0 which depends on Parquet-java 1.16.0 which contains the variant logical type annotation.
This change is hidden behind a flag that is disabled by default until read support can be properly implemented.
### Does this PR introduce _any_ user-facing change?
Yes, Parquet files written by Spark 4.1.0 with the flag enabled (which it eventually will be by default) could contain the variant logical type annotation which readers without support for the type will not be able to read
### How was this patch tested?
Unit test to check if nested as well as top-level variants are properly annotated, and the data is being written correctly.
### Was this patch authored or co-authored using generative AI tooling?
No.
Closes #53005 from harshmotw-db/harshmotw-db/variant_annotation_write.
Authored-by: Harsh Motwani <harsh.motwani@databricks.com>
Signed-off-by: Wenchen Fan <wenchen@databricks.com>
(cherry picked from commit 5270c99)
Signed-off-by: Wenchen Fan <wenchen@databricks.com>1 parent 2ee1dcb commit 51d7a20
File tree
4 files changed
+104
-5
lines changed- sql
- catalyst/src/main/scala/org/apache/spark/sql/internal
- core/src
- main/scala/org/apache/spark/sql/execution/datasources/parquet
- test/scala/org/apache/spark/sql/execution/datasources/parquet
4 files changed
+104
-5
lines changedLines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1585 | 1585 | | |
1586 | 1586 | | |
1587 | 1587 | | |
| 1588 | + | |
| 1589 | + | |
| 1590 | + | |
| 1591 | + | |
| 1592 | + | |
| 1593 | + | |
| 1594 | + | |
| 1595 | + | |
1588 | 1596 | | |
1589 | 1597 | | |
1590 | 1598 | | |
| |||
7638 | 7646 | | |
7639 | 7647 | | |
7640 | 7648 | | |
| 7649 | + | |
| 7650 | + | |
7641 | 7651 | | |
7642 | 7652 | | |
7643 | 7653 | | |
| |||
Lines changed: 20 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
373 | 373 | | |
374 | 374 | | |
375 | 375 | | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
376 | 380 | | |
377 | 381 | | |
378 | 382 | | |
| |||
552 | 556 | | |
553 | 557 | | |
554 | 558 | | |
555 | | - | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
556 | 562 | | |
557 | 563 | | |
558 | 564 | | |
| |||
563 | 569 | | |
564 | 570 | | |
565 | 571 | | |
566 | | - | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
567 | 575 | | |
568 | 576 | | |
569 | 577 | | |
| |||
817 | 825 | | |
818 | 826 | | |
819 | 827 | | |
820 | | - | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
821 | 833 | | |
822 | 834 | | |
823 | 835 | | |
824 | 836 | | |
825 | 837 | | |
826 | 838 | | |
827 | | - | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
828 | 844 | | |
829 | 845 | | |
830 | 846 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
523 | 523 | | |
524 | 524 | | |
525 | 525 | | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
526 | 530 | | |
527 | 531 | | |
528 | 532 | | |
| |||
Lines changed: 70 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
| 23 | + | |
22 | 24 | | |
23 | 25 | | |
24 | 26 | | |
25 | 27 | | |
26 | | - | |
| 28 | + | |
27 | 29 | | |
28 | 30 | | |
29 | 31 | | |
| |||
154 | 156 | | |
155 | 157 | | |
156 | 158 | | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
157 | 226 | | |
158 | 227 | | |
159 | 228 | | |
| |||
0 commit comments