Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPARK-47846][SQL] Add support for Variant type in from_json expression #46046

Closed
wants to merge 18 commits into from

Conversation

harshmotw-db
Copy link
Contributor

@harshmotw-db harshmotw-db commented Apr 15, 2024

What changes were proposed in this pull request?

Added support for the Variant type in the from_json expression. SQL statements like select from_json('{"a": 1, "b": 0.8}', 'variant') should convert the input json string to the variant type.

Why are the changes needed?

Earlier, from_json only supported fixed schemas in the schema field. Adding the variant data type should allow support for semi-structured data.

Does this PR introduce any user-facing change?

Yes, users can now specify 'variant' as the schema in from_json

How was this patch tested?

Unit tests. from_json/to_json round trip tests are identical to parse_json/to_json tests.

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

No

@harshmotw-db harshmotw-db changed the title From json variant [SPARK-47846][SQL] Add support for Variant type in from_json expression Apr 15, 2024
@harshmotw-db harshmotw-db marked this pull request as ready for review April 15, 2024 04:59
@github-actions github-actions bot removed the PYTHON label Apr 16, 2024
@harshmotw-db
Copy link
Contributor Author

@chenhao-db can you please look at this whenever you're free?

@cloud-fan
Copy link
Contributor

thanks, merging to master!

@cloud-fan cloud-fan closed this in 61a7901 Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants