You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Wenchen Fan (Jira)" <ji...@apache.org> on 2025/01/09 05:42:00 UTC

[jira] [Assigned] (SPARK-50749) Fix ordering bug in CommutativeExpression.gatherCommutative method

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

Wenchen Fan reassigned SPARK-50749:
-----------------------------------

    Assignee: Utkarsh Agarwal

> Fix ordering bug in CommutativeExpression.gatherCommutative method
> ------------------------------------------------------------------
>
>                 Key: SPARK-50749
>                 URL: https://issues.apache.org/jira/browse/SPARK-50749
>             Project: Spark
>          Issue Type: Bug
>          Components: Optimizer
>    Affects Versions: 4.0.0
>            Reporter: Utkarsh Agarwal
>            Assignee: Utkarsh Agarwal
>            Priority: Major
>              Labels: pull-request-available
>
> SPARK-49977 introduced a bug in the `CommutativeExpression.gatherCommutative()` method, changing the function's output order.
> Consider the following concrete example:
> ```
>     val addExpression = Add(
>       Literal(1),
>       Add(
>         Literal(2),
>         Literal(3)
>       )
>     )
>     val commutativeExpressions = addExpression.gatherCommutative(addExpression,
>       \{ case Add(l, r, _) => Seq(l, r)})
> ``` 
> Consider the output of the `gatherCommutative` method. SPARK-49977 introduced a bug that reversed the output order. This PR fixes the bug in `gatherCommutative()` to restore the original correct ordered output.
> ```
> // Prior to SPARK-49977 and after this fix
> // commutativeExpressions -> Seq(Literal(1), Literal(2), Literal(3)))
> // Post SPARK-49977 and before this fix
> // commutativeExpressions -> Seq(Literal(3), Literal(2), Literal(1)))
> ```



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org