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

Kelvin Jiang updated SPARK-47839:
---------------------------------
    Description: 
The following query will fail:

{code:SQL}
SELECT NULLIF(id + 1, 1)
from range(10)
group by id
{code}

This is because {{NullIf}} gets rewritten to {{With}}, then 
{{RewriteWithExpression}} tries to pull common expression {{id + 1}} out of the 
aggregate, resulting in an invalid plan.

  was:
The following query will fail:

```
SELECT NULLIF(id + 1, 1)
from range(10)
group by id
```

This is because `NullIf` gets rewritten to `With`, then `RewriteWithExpression` 
tries to pull `id + 1` out of the aggregate, resulting in an invalid plan.


> Fix Aggregate bug in RewriteWithExpression
> ------------------------------------------
>
>                 Key: SPARK-47839
>                 URL: https://issues.apache.org/jira/browse/SPARK-47839
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 4.0.0
>            Reporter: Kelvin Jiang
>            Priority: Major
>              Labels: pull-request-available
>
> The following query will fail:
> {code:SQL}
> SELECT NULLIF(id + 1, 1)
> from range(10)
> group by id
> {code}
> This is because {{NullIf}} gets rewritten to {{With}}, then 
> {{RewriteWithExpression}} tries to pull common expression {{id + 1}} out of 
> the aggregate, resulting in an invalid plan.



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

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

Reply via email to