-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-28200][SQL] Decimal overflow handling in ExpressionEncoder #25016
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
Changes from 4 commits
414e48f
b3740ba
f922ff3
0ed62b3
2513ea7
87073da
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -162,6 +162,32 @@ class RowEncoderSuite extends CodegenInterpretedPlanTest { | |||||
| assert(row.toSeq(schema).head == decimal) | ||||||
| } | ||||||
|
|
||||||
| test("RowEncoder should respect nullOnOverflow for decimals") { | ||||||
|
||||||
| val schema = new StructType().add("decimal", DecimalType.SYSTEM_DEFAULT) | ||||||
| testDecimalOverflow(schema, Row(BigDecimal("9" * 100))) | ||||||
| testDecimalOverflow(schema, Row(new java.math.BigDecimal("9" * 100))) | ||||||
| } | ||||||
|
|
||||||
| private def testDecimalOverflow(schema: StructType, row: Row): Unit = { | ||||||
| withSQLConf(SQLConf.DECIMAL_OPERATIONS_NULL_ON_OVERFLOW.key -> false.toString) { | ||||||
|
||||||
| withSQLConf(SQLConf.DECIMAL_OPERATIONS_NULL_ON_OVERFLOW.key -> false.toString) { | |
| withSQLConf(SQLConf.DECIMAL_OPERATIONS_NULL_ON_OVERFLOW.key -> "false") { |
Outdated
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.
| withSQLConf(SQLConf.DECIMAL_OPERATIONS_NULL_ON_OVERFLOW.key -> true.toString) { | |
| withSQLConf(SQLConf.DECIMAL_OPERATIONS_NULL_ON_OVERFLOW.key -> "true") { |
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.
shall we use
-BigDecimal...instead of.unary_-