[
https://issues.apache.org/jira/browse/SPARK-59151?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Stefan Savic updated SPARK-59151:
---------------------------------
Description:
Implement an internal CanonicalizeVariant(child) Catalyst expression that
converts a VARIANT into a canonical binary representation. Values considered
equal under Variant equality semantics should produce identical canonical bytes.
The implementation should:
• Normalize the field-name dictionary and object layout, removing unused
dictionary entries and remapping field references.
• Normalize equivalent scalar encodings, including integer widths, decimal
scales, negative zero, and NaN representations.
• Preserve array element order and distinctions between unequal values.
• Detect already-canonical inputs and reuse them without rebuilding.
• Accept and return VARIANT, preserve SQL NULL handling, and support
interpreted evaluation and code generation.
Add tests covering equivalent and unequal values, nested objects and arrays,
extracted sub-Variants, null handling, and repeated canonicalization.
was:
Implement canonicalization (+ fastpath aka checking if Variant is already
canonicalized)
This part contains only canonicalization, without wiring to expressions
After canonicalization Variant should have
- All dict keys sorted
- No unused keys
- All numeric types normalized to smallest fitting datatype (e.g.: [10 as
int64] and [10.0 as decimal] to 10 as int8
- float/double -0.0 converted to 0.0
- Have all NaNs in normalised form
> Implement the CanonicalizeVariant Catalyst expression
> -----------------------------------------------------
>
> Key: SPARK-59151
> URL: https://issues.apache.org/jira/browse/SPARK-59151
> Project: Spark
> Issue Type: Sub-task
> Components: SQL
> Affects Versions: 5.0.0
> Reporter: Aleksandr Chernousov
> Priority: Major
> Labels: pull-request-available
>
> Implement an internal CanonicalizeVariant(child) Catalyst expression that
> converts a VARIANT into a canonical binary representation. Values considered
> equal under Variant equality semantics should produce identical canonical
> bytes.
> The implementation should:
> • Normalize the field-name dictionary and object layout, removing unused
> dictionary entries and remapping field references.
> • Normalize equivalent scalar encodings, including integer widths, decimal
> scales, negative zero, and NaN representations.
> • Preserve array element order and distinctions between unequal values.
> • Detect already-canonical inputs and reuse them without rebuilding.
> • Accept and return VARIANT, preserve SQL NULL handling, and support
> interpreted evaluation and code generation.
> Add tests covering equivalent and unequal values, nested objects and arrays,
> extracted sub-Variants, null handling, and repeated canonicalization.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]