Skip to content

[SPARK-36851][SQL] Incorrect parsing of negative ANSI typed interval literals#34107

Closed
Peng-Lei wants to merge 1 commit intoapache:masterfrom
Peng-Lei:SPARK-36851
Closed

[SPARK-36851][SQL] Incorrect parsing of negative ANSI typed interval literals#34107
Peng-Lei wants to merge 1 commit intoapache:masterfrom
Peng-Lei:SPARK-36851

Conversation

@Peng-Lei
Copy link
Contributor

What changes were proposed in this pull request?

Handle incorrect parsing of negative ANSI typed interval literals
SPARK-36851

Why are the changes needed?

Incorrect result:

spark-sql> select interval -'1' year;
1-0

Does this PR introduce any user-facing change?

No

How was this patch tested?

Add ut testcase

@github-actions github-actions bot added the SQL label Sep 26, 2021
@Peng-Lei
Copy link
Contributor Author

@MaxGekk Could you take a look ? Is this fix okay ? Thank you.

@AmplabJenkins
Copy link

Can one of the admins verify this patch?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's move the test cases into interval.sql.
Also, we should add tests for negative day time intervals as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@gengliangwang
Copy link
Member

I will cut RC5 after merging this one.

@gengliangwang
Copy link
Member

Thanks, merging to master/3.2

gengliangwang pushed a commit that referenced this pull request Sep 26, 2021
…literals

### What changes were proposed in this pull request?
Handle incorrect parsing of negative ANSI typed interval literals
[SPARK-36851](https://issues.apache.org/jira/browse/SPARK-36851)

### Why are the changes needed?
Incorrect result:
```
spark-sql> select interval -'1' year;
1-0
```

### Does this PR introduce _any_ user-facing change?
No

### How was this patch tested?
Add ut testcase

Closes #34107 from Peng-Lei/SPARK-36851.

Authored-by: PengLei <peng.8lei@gmail.com>
Signed-off-by: Gengliang Wang <gengliang@apache.org>
(cherry picked from commit 0fdca1f)
Signed-off-by: Gengliang Wang <gengliang@apache.org>
@cloud-fan
Copy link
Contributor

good catch!

Copy link
Member

@MaxGekk MaxGekk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have only the concern about the place you fixed. You changed the code related to multi units intervals parsing but I assume ANSI intervals (unit to unit) in my example in the JIRA ticket.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants