Stefan Savic created SPARK-62380:
------------------------------------
Summary: Implement a total ordering for VARIANT values
Key: SPARK-62380
URL: https://issues.apache.org/jira/browse/SPARK-62380
Project: Spark
Issue Type: Sub-task
Components: SQL
Affects Versions: 5.0.0
Reporter: Stefan Savic
Define a total order over all VARIANT values and implement it in Catalyst:
* Specify the order: SQL NULL first (as for other types), then a fixed order
across Variant types (for example null, boolean, numeric, string, binary,
date/time types, array, object), with numerics compared by value regardless of
encoding, strings by binary order, arrays element-wise then by length, and
objects by sorted field name then value.
* The order must be consistent with Variant equality from SPARK-59150: values
with identical canonical bytes compare as equal, and unequal values never
compare as equal.
* Implement interpreted and code-generated comparison (ordering support for
VariantType in the Catalyst ordering and codegen compare), and make every
ordering consumer use it: Sort, range partitioning, window ORDER BY frames,
min/max, max_by/min_by, array_sort, sort_array, array_min/array_max, top-k
collection, and ordered typed grouping.
* Where an ordering consumer compares raw bytes instead of calling the
ordering, insert canonicalization or route it through the ordering so results
do not depend on the physical encoding.
* Add unit tests covering every Variant type pair, equivalent encodings, nested
arrays and objects, and null handling.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]