huaxingao commented on a change in pull request #29695:
URL: https://github.com/apache/spark/pull/29695#discussion_r498629353
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceStrategy.scala
##########
@@ -643,6 +647,34 @@ object DataSourceStrategy {
(nonconvertiblePredicates ++ unhandledPredicates, pushedFilters,
handledFilters)
}
+ def translateAggregate(aggregates: AggregateExpression):
Option[AggregateFunc] = {
+
+ def columnAsString(e: Expression): String = e match {
+ case AttributeReference(name, _, _, _) => name
+ case Cast(child, _, _) => child match {
Review comment:
If the col data type is float, I think we should remove the cast and
pass it to database side. On database side, cast it to double:
```
if (cast by Spark)
remove cast from sum
push down Sum(col) to database
if (datatype of col is float)
cast to Double, something like SELECT Sum(CAST(col AS DOUBLE)) FROM
table
else // cast by user
not remove cast and not push down aggregate
```
----------------------------------------------------------------
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]