[ 
https://issues.apache.org/jira/browse/SPARK-62379?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Stefan Savic updated SPARK-62379:
---------------------------------
    Description: 
Currently the VARIANT data type cannot be used where values are ordered: ORDER 
BY and SORT BY, range partitioning, window ORDER BY frames, min/max, 
max_by/min_by, array_sort, sort_array, array_min/array_max, and top-k 
collection. The analyzer rejects Variant as not orderable.

Variant has no defined total order today, and logically equal Variants can have 
different binary encodings, so byte-wise ordering of the raw encoding cannot be 
used. SPARK-59150 adds CanonicalizeVariant for equality-based operations; 
ordering needs a comparison that is consistent with that equality (identical 
canonical bytes compare as equal) and total across all Variant types.

Plan:
# SPARK-62380: define a total ordering for VARIANT values and implement it in 
Catalyst (interpreted and codegen), used by every ordering consumer.
# SPARK-62381: enable the feature end to end: relax the analyzer orderability 
checks, make sort-based execution including spilling work on Variant keys, and 
add SQL tests.


  was:placeholder


> Support ordering operations on VARIANT (ORDER BY, min/max, sort functions)
> --------------------------------------------------------------------------
>
>                 Key: SPARK-62379
>                 URL: https://issues.apache.org/jira/browse/SPARK-62379
>             Project: Spark
>          Issue Type: Umbrella
>          Components: SQL
>    Affects Versions: 5.0.0
>            Reporter: Stefan Savic
>            Priority: Major
>
> Currently the VARIANT data type cannot be used where values are ordered: 
> ORDER BY and SORT BY, range partitioning, window ORDER BY frames, min/max, 
> max_by/min_by, array_sort, sort_array, array_min/array_max, and top-k 
> collection. The analyzer rejects Variant as not orderable.
> Variant has no defined total order today, and logically equal Variants can 
> have different binary encodings, so byte-wise ordering of the raw encoding 
> cannot be used. SPARK-59150 adds CanonicalizeVariant for equality-based 
> operations; ordering needs a comparison that is consistent with that equality 
> (identical canonical bytes compare as equal) and total across all Variant 
> types.
> Plan:
> # SPARK-62380: define a total ordering for VARIANT values and implement it in 
> Catalyst (interpreted and codegen), used by every ordering consumer.
> # SPARK-62381: enable the feature end to end: relax the analyzer orderability 
> checks, make sort-based execution including spilling work on Variant keys, 
> and add SQL tests.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to