skambha commented on a change in pull request #27627: [WIP][SPARK-28067][SQL] 
Fix incorrect results for decimal aggregate sum by returning null on decimal 
overflow
URL: https://github.com/apache/spark/pull/27627#discussion_r386739126
 
 

 ##########
 File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/decimalExpressions.scala
 ##########
 @@ -132,3 +132,32 @@ case class CheckOverflow(
 
   override def sql: String = child.sql
 }
+
+case class HasOverflow(
+    child: Expression,
+    inputType: DecimalType) extends UnaryExpression {
+
+  override def dataType: DataType = BooleanType
+
+  override def nullable: Boolean = true
 
 Review comment:
   Since the child can be nullable, the input value can be null.   Making 
nullable to false in that case will not work, as it may result in npe.  We can 
change the doGenCode() here to make the check for null for that, but since  the 
nullSafeCodeGen in UnaryExpression already takes care of the if nullable 
checks,  it seems there is no need to add if null checks here. 

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

Reply via email to