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



##########
File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceStrategy.scala
##########
@@ -673,6 +675,27 @@ object DataSourceStrategy
     (nonconvertiblePredicates ++ unhandledPredicates, pushedFilters, 
handledFilters)
   }
 
+  protected[sql] def translateAggregate(
+      aggregates: AggregateExpression,
+      pushableColumn: PushableColumnBase): Option[AggregateFunc] = {
+    aggregates.aggregateFunction match {
+      case min @ aggregate.Min(pushableColumn(name)) =>
+        Some(Min(FieldReference(Seq(name)), min.dataType))
+      case max @ aggregate.Max(pushableColumn(name)) =>
+        Some(Max(FieldReference(Seq(name)), max.dataType))
+      case count: aggregate.Count =>
+        count.children.head match {
+          // SELECT COUNT(*) FROM table is translated to SELECT 1 FROM table
+          case Literal(_, _) =>
+            Some(Count(LiteralValue(1, LongType), LongType, 
aggregates.isDistinct))

Review comment:
       nit: `1L`




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