cloud-fan commented on a change in pull request #35320:
URL: https://github.com/apache/spark/pull/35320#discussion_r838595964



##########
File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/V2ScanRelationPushDown.scala
##########
@@ -140,14 +141,18 @@ object V2ScanRelationPushDown extends Rule[LogicalPlan] 
with PredicateHelper wit
                         val count = 
aggregate.Count(avg.child).toAggregateExpression(isDistinct)
                         // Closely follow `Average.evaluateExpression`
                         avg.dataType match {
+                          case dt: DecimalType if avg.failOnError =>
+                            
addCastIfNeeded(DecimalPrecision.decimalAndDecimal()(
+                              Divide(
+                                CheckOverflowInSum(sum, dt, false),

Review comment:
       shall we cast it to `avg.sumDataType`?




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