forked from apache/spark
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SPARK-50815][PYTHON][SQL] Fix bug where passing null Variants in cre…
…ateDataFrame causes it to fail and add Variant support in createDataFrame in Spark Connect ### What changes were proposed in this pull request? In this PR, we add a case to handle None in `VariantType.toInternal`. Also, variants can be used with `createDataFrame` when using Spark Connect. ### Why are the changes needed? Previously, `spark.createDataFrame([(VariantVal(bytearray([12, 1]), bytearray([1, 0, 0])),), (None,)], "v variant").show()` failed because there was no way of handling nulls. Also, `createDataFrame` did not work with Variants prior to this PR - now it does. ### Does this PR introduce _any_ user-facing change? Yes, it fixes a bug where `None` values couldn't be handled with Variant schemas, and allows users to use createDataFrame with Variants in the Python client. ### How was this patch tested? Unit test ### Was this patch authored or co-authored using generative AI tooling? No Closes apache#49487 from harshmotw-db/harsh-motwani_data/variant_bug_fix. Authored-by: Harsh Motwani <[email protected]> Signed-off-by: Wenchen Fan <[email protected]>
- Loading branch information
1 parent
21a37a7
commit 39bb2d8
Showing
3 changed files
with
37 additions
and
8 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
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