You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/07/18 05:24:53 UTC
[GitHub] [spark] cloud-fan commented on a diff in pull request #37207: [SPARK-39792][SQL] Add DecimalDivideWithOverflowCheck for decimal average
cloud-fan commented on code in PR #37207:
URL: https://github.com/apache/spark/pull/37207#discussion_r922979739
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/decimalExpressions.scala:
##########
@@ -247,3 +247,76 @@ case class DecimalAddNoOverflowCheck(
newLeft: Expression, newRight: Expression): DecimalAddNoOverflowCheck =
copy(left = newLeft, right = newRight)
}
+
+/**
+ * A divide expression for decimal values which is only used internally by Avg.
+ *
+ * It will fail when nullOnOverflow is false follows:
+ * - left is null, as the right side should never be null
Review Comment:
since we only invoke `DecimalDivideWithOverflowCheck` when count > 0, I think left (`sum` in AVG) will never be null?
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org