Skip to content
Snippets Groups Projects
Commit f55bd4c7 authored by Herman van Hovell's avatar Herman van Hovell Committed by gatorsmile
Browse files

[SPARK-19472][SQL] Parser should not mistake CASE WHEN(...) for a function call


## What changes were proposed in this pull request?
The SQL parser can mistake a `WHEN (...)` used in `CASE` for a function call. This happens in cases like the following:
```sql
select case when (1) + case when 1 > 0 then 1 else 0 end = 2 then 1 else 0 end
from tb
```
This PR fixes this by re-organizing the case related parsing rules.

## How was this patch tested?
Added a regression test to the `ExpressionParserSuite`.

Author: Herman van Hovell <hvanhovell@databricks.com>

Closes #16821 from hvanhovell/SPARK-19472.

(cherry picked from commit cb2677b8)
Signed-off-by: default avatargatorsmile <gatorsmile@gmail.com>
parent 7c23bd49
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment