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

Stefan Savic updated SPARK-60338:
---------------------------------
    Description: 
Implement optimizer rules, modeled on InsertMapSortInAggregate and 
InsertMapSortInRepartitionExpressions, that wrap Variant values in 
CanonicalizeVariant wherever they are compared or hashed, so logically equal 
Variants have identical bytes at the point of comparison:

* Equality predicates (=, <=>, IN, INSET, IN subqueries) and hash expressions, 
including comparisons inside lambdas and conditional branches.
* Set operations (UNION/INTERSECT/EXCEPT) through the join and aggregate 
predicates generated for them.
* Equality-based aggregate arguments: DISTINCT aggregates, collect_set, pivot 
keys; applied to the argument itself so FILTER and window aggregates are 
covered.
* Grouping keys (after PullOutGroupingExpressions), keeping the aggregate 
output attributes stable.
* Repartition and rebalance keys, window partition keys, streaming 
deduplication keys, and the keys of the (co)group-by-key APIs for Scala, Python 
and R.

Guarded by spark.sql.optimizer.insertVariantCanonicalization.enabled. Add plan 
tests for every rule, including nested Variants inside structs, arrays and maps 
and extraction expressions such as canonicalize(variant_get(...)).


  was:
Implement optimizer rules modeled on InsertMapSortInAggregate and 
InsertMapSortInRepartitionExpressions that:

  • Insert CanonicalizeVariant around Variant grouping keys and distinct 
aggregate arguments.
  • Run the aggregation rewrite after PullOutGroupingExpressions.
  • Update grouping and output references to use the canonicalized keys.
  • Canonicalize explicit repartitioning keys consistently.
  • Add plan tests, including extraction expressions such as 
canon(variant_get(...)).

        Summary: Insert Variant canonicalization into equality-based operations 
 (was: Insert Variant canonicalization into aggregation and repartitioning 
plans)

> Insert Variant canonicalization into equality-based operations
> --------------------------------------------------------------
>
>                 Key: SPARK-60338
>                 URL: https://issues.apache.org/jira/browse/SPARK-60338
>             Project: Spark
>          Issue Type: Sub-task
>          Components: Spark Core
>    Affects Versions: 5.0.0
>            Reporter: Stefan Savic
>            Priority: Major
>              Labels: pull-request-available
>
> Implement optimizer rules, modeled on InsertMapSortInAggregate and 
> InsertMapSortInRepartitionExpressions, that wrap Variant values in 
> CanonicalizeVariant wherever they are compared or hashed, so logically equal 
> Variants have identical bytes at the point of comparison:
> * Equality predicates (=, <=>, IN, INSET, IN subqueries) and hash 
> expressions, including comparisons inside lambdas and conditional branches.
> * Set operations (UNION/INTERSECT/EXCEPT) through the join and aggregate 
> predicates generated for them.
> * Equality-based aggregate arguments: DISTINCT aggregates, collect_set, pivot 
> keys; applied to the argument itself so FILTER and window aggregates are 
> covered.
> * Grouping keys (after PullOutGroupingExpressions), keeping the aggregate 
> output attributes stable.
> * Repartition and rebalance keys, window partition keys, streaming 
> deduplication keys, and the keys of the (co)group-by-key APIs for Scala, 
> Python and R.
> Guarded by spark.sql.optimizer.insertVariantCanonicalization.enabled. Add 
> plan tests for every rule, including nested Variants inside structs, arrays 
> and maps and extraction expressions such as canonicalize(variant_get(...)).



--
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