cloud-fan commented on a change in pull request #29448:
URL: https://github.com/apache/spark/pull/29448#discussion_r471252206
##########
File path: sql/core/src/test/scala/org/apache/spark/sql/DataFrameSuite.scala
##########
@@ -192,23 +192,19 @@ class DataFrameSuite extends QueryTest
structDf.select(xxhash64($"a", $"record.*")))
}
- test("SPARK-28224: Aggregate sum big decimal overflow") {
+ test("SPARK-28224,SPARK-32018: Aggregate sum big decimal overflow") {
val largeDecimals = spark.sparkContext.parallelize(
DecimalData(BigDecimal("1"* 20 + ".123"), BigDecimal("1"* 20 + ".123"))
::
DecimalData(BigDecimal("9"* 20 + ".123"), BigDecimal("9"* 20 +
".123")) :: Nil).toDF()
Seq(true, false).foreach { ansiEnabled =>
withSQLConf((SQLConf.ANSI_ENABLED.key, ansiEnabled.toString)) {
val structDf = largeDecimals.select("a").agg(sum("a"))
- if (!ansiEnabled) {
- checkAnswer(structDf, Row(null))
- } else {
- val e = intercept[SparkException] {
- structDf.collect
- }
- assert(e.getCause.getClass.equals(classOf[ArithmeticException]))
- assert(e.getCause.getMessage.contains("cannot be represented as
Decimal"))
+ val e = intercept[SparkException] {
+ structDf.collect
Review comment:
Can we add a comment to say that we have to fail overflow with non-ansi
mode as well, and link the related JIRA tickets?
----------------------------------------------------------------
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]