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



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

Review comment:
       Now I have a better idea: how about we just take 
`Average.evaluateExpression` and replace its sum/count attribute with new ones?
   ```
   avg.evaluateExpression transform {
     case a: Attribute if a.semanticEquals(avg.sum) => addCastIfNeeded(sum, 
avg.sum.dataType)
     case a: Attribute if a.semanticEquals(avg.count) => addCastIfNeeded(count, 
avg.count.dataType)
   }
   ```




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