-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[v1] Change integer types to error on overflow; give explicit data exception on div/mod by 0 #1715
Conversation
CROSS-ENGINE-REPORT ❌
Testing Details
Result Details
Now FAILING Tests ❌The complete list can be found in GitHub CI summary, either from Step Summary or in the Artifact. Now IGNORED Tests ❌The complete list can be found in GitHub CI summary, either from Step Summary or in the Artifact. Now Passing Tests165 test(s) were previously failing in BASE (LEGACY-V0.14.8) but now pass in TARGET (EVAL-68547A4). Before merging, confirm they are intended to pass. The complete list can be found in GitHub CI summary, either from Step Summary or in the Artifact. CROSS-COMMIT-REPORT ✅
Testing DetailsResult Details
|
8d67e7b
to
afc865a
Compare
…ception on div/mod by 0
afc865a
to
34f1aa3
Compare
val arg0 = args[0].byte | ||
val arg1 = args[1].byte | ||
if (arg1 == 0.toByte()) { | ||
throw DataException("Division by zero for TINYINT: $arg0 % $arg1") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice 👍 . SQL:1999 Section 6.17.
val arg1 = args[1].byte | ||
val result = arg0 + arg1 | ||
if (result.byteOverflows()) { | ||
throw DataException("Numeric value out of range for TINYINT: $arg0 + $arg1") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
throw DataException("Numeric value out of range for TINYINT: $arg0 + $arg1") | |
throw DataException("Resulting value out of range for TINYINT: $arg0 + $arg1") |
Non-blocking, but the use of "numeric" might be confusing due to there being a numeric data type.
@@ -21,7 +21,7 @@ internal object FnDivide : DiadicArithmeticOperator("divide") { | |||
if (arg1 == 0.toByte()) { | |||
throw DataException("Division by zero for TINYINT: $arg0 / $arg1") | |||
} else if (arg0 == Byte.MIN_VALUE && arg1.toInt() == -1) { | |||
throw DataException("Overflow for TINYINT: $arg0 / $arg1") | |||
throw DataException("Resulting value out of range for: $arg0 / $arg1") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the following 3, you removed the type name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah my bad. I will fix in the target branch.
…or on overflow * [v1] Re-enable randomized tests * [v1] Change integer types to error on overflow; give explicit data exception on div/mod by 0 (#1715)
Relevant Issues
Description
License Information
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.