Skip to content

Conversation

@gengliangwang
Copy link
Member

What changes were proposed in this pull request?

Similar with #37313, currently, when arithmetic overflow errors happen under ANSI mode, the error messages are like

[ARITHMETIC_OVERFLOW] long overflow. Use 'try_multiply' to tolerate overflow and return NULL instead. If necessary set spark.sql.ansi.enabled to "false" 

The "(except for ANSI interval type)" part is confusing. We should remove it for the numeric arithmetic operations and have a new error class for the interval division error: INTERVAL_ARITHMETIC_OVERFLOW

Why are the changes needed?

For better error messages

Does this PR introduce any user-facing change?

Yes, Use different error classes for arithmetic overflows of numeric/interval.. After changes, the error messages are simpler and more clear.

How was this patch tested?

UT

…rithmetic overflow

### What changes were proposed in this pull request?

Similar with apache#37313, currently, when  arithmetic overflow errors happen under ANSI mode, the error messages are like
```
[ARITHMETIC_OVERFLOW] long overflow. Use 'try_multiply' to tolerate overflow and return NULL instead. If necessary set spark.sql.ansi.enabled to "false"
```

The "(except for ANSI interval type)" part is confusing. We should remove it for the numeric arithmetic operations and have a new error class for the interval division error: `INTERVAL_ARITHMETIC_OVERFLOW`

### Why are the changes needed?

For better error messages

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

Yes, Use different error classes for arithmetic overflows of numeric/interval.. After changes, the error messages are simpler and more clear.

### How was this patch tested?

UT

Closes apache#37337 from gengliangwang/improveOverflowMsg.

Authored-by: Gengliang Wang <gengliang@apache.org>
Signed-off-by: Gengliang Wang <gengliang@apache.org>
@gengliangwang
Copy link
Member Author

This PR is to cherry-pick #37337 again, which was reverted since it fail to compile after #37343 is merged

@gengliangwang
Copy link
Member Author

Merging to master

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants