amaliujia commented on code in PR #40693:
URL: https://github.com/apache/spark/pull/40693#discussion_r1162331907


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/arithmetic.scala:
##########
@@ -820,11 +821,13 @@ case class Divide(
   }
 
   private lazy val div: (Any, Any) => Any = dataType match {
-    case d @ DecimalType.Fixed(precision, scale) => (l, r) => {
-      val value = d.fractional.asInstanceOf[Fractional[Any]].div(l, r)
-      checkDecimalOverflow(value.asInstanceOf[Decimal], precision, scale)
-    }
-    case ft: FractionalType => ft.fractional.asInstanceOf[Fractional[Any]].div
+    case d @ DecimalType.Fixed(precision, scale) =>
+      val fractional = PhysicalDecimalType(precision, scale).fractional
+      (l, r) => {
+        val value = fractional.asInstanceOf[Fractional[Any]].div(l, r)

Review Comment:
   If you think this is better, we can still does 
`PhysicalFrancitonalType.franctional(dt: Datatype)` which does a resolution but 
hide the `asInstanceOf[Fractional[Any]]`?



-- 
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]

Reply via email to