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/01/08 00:55:00 UTC

[GitHub] [spark] beliefer commented on a change in pull request #35130: [SPARK-37839][SQL] DS V2 supports partial aggregate push-down AVG

beliefer commented on a change in pull request #35130:
URL: https://github.com/apache/spark/pull/35130#discussion_r780603780



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/jdbc/JdbcDialects.scala
##########
@@ -223,7 +225,11 @@ abstract class JdbcDialect extends Serializable with Logging{
       case f: GeneralAggregateFunc if f.name() == "AVG" =>
         assert(f.inputs().length == 1)
         val distinct = if (f.isDistinct) "DISTINCT " else ""
-        Some(s"AVG($distinct${f.inputs().head})")
+        if (supportCompletePushDown) {
+          Some(s"AVG($distinct${f.inputs().head})")
+        } else {
+          Some(s"Sum($distinct${f.inputs().head}), Count($distinct${f.inputs().head})")

Review comment:
       If Spark cannot complete pushdown AVG to database, we still want partial pushdown.




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