ulysses-you commented on code in PR #38760:
URL: https://github.com/apache/spark/pull/38760#discussion_r1030015079
##########
sql/core/src/test/scala/org/apache/spark/sql/DataFrameSuite.scala:
##########
@@ -3537,6 +3537,12 @@ class DataFrameSuite extends QueryTest
}.isEmpty)
}
}
+
+ test("SPARK-41219: Decimal changePrecision should work with decimal(0, 0)") {
+ val df = Seq("0.5944910").toDF("a")
+ checkAnswer(df.selectExpr("cast(a as decimal(7,7)) div 100"), Row(0))
Review Comment:
@cloud-fan see this test, the decimal type of IntegralDivide can be
`decimal(0, 0)` (other BinaryArithmetic does not have the issue).
https://github.com/apache/spark/blob/d275a83c582a23d7730b5a35a335f9cd10c2741c/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/arithmetic.scala#L864-L868
Or, we may change it to `max(p1 - s1 + s2, 1)`
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]