turboFei commented on a change in pull request #25701: [SPARK-29000][SQL]
Decimal precision overflow when don't allow precision loss
URL: https://github.com/apache/spark/pull/25701#discussion_r321547661
##########
File path:
sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveQuerySuite.scala
##########
@@ -1224,6 +1224,15 @@ class HiveQuerySuite extends HiveComparisonTest with
SQLTestUtils with BeforeAnd
}
}
}
+
+ test("SPARK-29000: arithmetic computation overflow when don't allow decimal
precision loss ") {
+ val allow = sql("set spark.sql.decimalOperations.allowPrecisionLoss")
+ val originValue = allow.collect().apply(0).apply(1)
+ sql("set spark.sql.decimalOperations.allowPrecisionLoss=false")
+ val df = sql("select case when 1=2 then 1 else
100.000000000000000000000000 end * 1")
+ QueryTest.checkAnswer(df, Array(Row(100)))
+ sql(s"set spark.sql.decimalOperations.allowPrecisionLoss=$originValue")
+ }
Review comment:
I have moved it into SQLQuerySuite in package `sql`. Thanks.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]