Repository navigation
Remove variant_get_json - #192
Merged
Merged
Conversation
Spark has no `variant_get_json`. Its spelling, `to_json(variant_get(v, path))`, already works and returns the same JSON. The fused function also panicked on shredded objects, since it read rows through `VariantArray::value`. Remove the UDF, the typed-getter macro, and the per-row and list-path helpers it alone used. List paths are gone with it, so every path is a Spark `$` string. Co-Authored-By: Claude Opus 5.5 <[email protected]>
sdf-jkl
marked this pull request as ready for review
November 13, 2026 19:28
This was referenced Nov 13, 2026
sdf-jkl
added a commit
to sdf-jkl/datafusion-variant
that referenced
this pull request
Nov 23, 2026
Scope the page to Spark 4.2.0, drop rows made stale by datafusion-contrib#143, datafusion-contrib#153, datafusion-contrib#187 and datafusion-contrib#192, link tests with absolute URLs, and add the page to the docs site and the README note. Enable field-extraction case 04 (fixed by apache/arrow-rs#11302) and the empty-key schema_of_variant case (apache/arrow-rs#10352), which pass on Arrow 60.1.0. Co-Authored-By: Claude Opus 5.5 <[email protected]>
alamb
pushed a commit
that referenced
this pull request
Nov 28, 2026
* Document Spark compatibility differences and their causes * Rewrite Spark compatibility page for Spark 4.2 and enable fixed cases Scope the page to Spark 4.2.0, drop rows made stale by #143, #153, #187 and #192, link tests with absolute URLs, and add the page to the docs site and the README note. Enable field-extraction case 04 (fixed by apache/arrow-rs#11302) and the empty-key schema_of_variant case (apache/arrow-rs#10352), which pass on Arrow 60.1.0. Co-Authored-By: Claude Opus 5.5 <[email protected]> * Drop the function list and ask readers to report differences Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #141.
variant_get_json(v, path)has no Spark counterpart. Spark writes it asto_json(variant_get(v, path)), which already works here and returns the same JSON text, including quotes around strings. This removesvariant_get_jsoninstead of keeping it as a documented extension, one of the options in the "Functions with no Spark 4.2 counterpart" item of #141.It also panics on shredded input. It reads rows through
VariantArray::iter(), and for a shredded objectVariantArray::value(i)panics withtry_value cannot materialize typed_value of type Struct ... call unshred_variant first. For example,variant_get_json(v, '$.a')over a Parquet file written with'variant.shredding' '{"v":"STRUCT<a VARCHAR>"}'panics instead of returning an error, whileto_json(variant_get(v, '$.a'))reads the same file correctly becausevariant_gethandles shredded columns.Keeping its kernel as a rewrite target for
to_json(variant_get(...))would not pay off either. In a local Criterion benchmark over 8,192 unshredded rows (direct UDF calls, two runs), the fused function was about 20% faster for a string at$.a(2.9 vs 3.7 ms, 3.8 vs 4.4 ms) and 11 to 28% slower for a nested object (12.0 vs 10.7 ms, 14.7 vs 10.6 ms), with 20 to 30% drift between runs. Both forms produced identical JSON on those inputs. The composed form serializes with Arrow's batchvariant_to_jsonkernel instead of allocating oneStringper row.Breaking changes:
variant_get_jsonSQL function and theVariantGetJsonUdfRust type are removed. Useto_json(variant_get(v, path)).variant_get_jsonwas the only function that accepted a list of field names, such asvariant_get_json(v, ['a.b', 'c']). Every path is now a Spark$string, here$['a.b'].c.The typed-getter macro and the per-row and list-path helpers in
src/shared.rshad no other callers and are removed as well.variant_root_paths.sltdrops itsvariant_get_jsoncolumns and keeps the scalar input, column path NULL case asto_json(variant_get(...)).Validation:
cargo test,cargo clippy --all-targets --all-features -- -D warnings,cargo fmt --all -- --check,cargo doc --no-deps, andtyposon the changed files all pass. The shredded panic was reproduced onmainwith a scratch SLT, not added as a test because the function is removed.🤖 Generated with Claude Code