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 2021/12/30 15:10:54 UTC

[GitHub] [spark] cloud-fan opened a new pull request #35070: [SPARK-37789][SQL] Add a class to represent general aggregate functions in DS V2

cloud-fan opened a new pull request #35070:
URL: https://github.com/apache/spark/pull/35070


   <!--
   Thanks for sending a pull request!  Here are some tips for you:
     1. If this is your first time, please read our contributor guidelines: https://spark.apache.org/contributing.html
     2. Ensure you have added or run the appropriate tests for your PR: https://spark.apache.org/developer-tools.html
     3. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP][SPARK-XXXX] Your PR title ...'.
     4. Be sure to keep the PR description updated to reflect all changes.
     5. Please write your PR title to summarize what this PR proposes.
     6. If possible, provide a concise example to reproduce the issue for a faster review.
     7. If you want to add a new configuration, please read the guideline first for naming configurations in
        'core/src/main/scala/org/apache/spark/internal/config/ConfigEntry.scala'.
     8. If you want to add or modify an error type or message, please read the guideline first in
        'core/src/main/resources/error/README.md'.
   -->
   
   ### What changes were proposed in this pull request?
   <!--
   Please clarify what changes you are proposing. The purpose of this section is to outline the changes and how this PR fixes the issue. 
   If possible, please consider writing useful notes for better and faster reviews in your PR. See the examples below.
     1. If you refactor some codes with changing classes, showing the class hierarchy will help reviewers.
     2. If you fix some SQL features, you can provide some references of other DBMSes.
     3. If there is design documentation, please add the link.
     4. If there is a discussion in the mailing list, please add the link.
   -->
   There are a lot of aggregate functions in SQL and it's a lot of work to add them one by one in the DS v2 API. This PR proposes to add a new `GeneralAggregateFunc` class to represent all the general SQL aggregate functions. Since it's general, Spark doesn't know its aggregation buffer and can only push down the aggregation to the source completely.
   
   As an example, this PR also translates `AVG` to `GeneralAggregateFunc` and pushes it to JDBC V2.
   
   ### Why are the changes needed?
   <!--
   Please clarify why the changes are needed. For instance,
     1. If you propose a new API, clarify the use case for a new API.
     2. If you fix a bug, you can clarify why it is a bug.
   -->
   To add aggregate functions in DS v2 easier.
   
   ### Does this PR introduce _any_ user-facing change?
   <!--
   Note that it means *any* user-facing change including all aspects such as the documentation fix.
   If yes, please clarify the previous behavior and the change this PR proposes - provide the console output, description and/or an example to show the behavior difference if possible.
   If possible, please also clarify if this is a user-facing change compared to the released Spark versions or within the unreleased branches such as master.
   If no, write 'No'.
   -->
   No
   
   ### How was this patch tested?
   <!--
   If tests were added, say they were added here. Please make sure to add some test cases that check the changes thoroughly including negative and positive cases if possible.
   If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future.
   If tests were not added, please describe why they were not added and/or why it was difficult to add.
   If benchmark tests were added, please run the benchmarks in GitHub Actions for the consistent environment, and the instructions could accord to: https://spark.apache.org/developer-tools.html#github-workflow-benchmarks.
   -->
   JDBC v2 test


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


[GitHub] [spark] beliefer commented on a change in pull request #35070: [SPARK-37789][SQL] Add a class to represent general aggregate functions in DS V2

Posted by GitBox <gi...@apache.org>.
beliefer commented on a change in pull request #35070:
URL: https://github.com/apache/spark/pull/35070#discussion_r776928859



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceStrategy.scala
##########
@@ -717,8 +717,10 @@ object DataSourceStrategy
               Some(new Count(FieldReference(name), agg.isDistinct))
             case _ => None
           }
-        case sum @ aggregate.Sum(PushableColumnWithoutNestedColumn(name), _) =>
+        case aggregate.Sum(PushableColumnWithoutNestedColumn(name), _) =>
           Some(new Sum(FieldReference(name), agg.isDistinct))
+        case aggregate.Average(PushableColumnWithoutNestedColumn(name), _) =>

Review comment:
       We can pass it.




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


[GitHub] [spark] cloud-fan commented on a change in pull request #35070: [SPARK-37789][SQL] Add a class to represent general aggregate functions in DS V2

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #35070:
URL: https://github.com/apache/spark/pull/35070#discussion_r777825470



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/V2ScanRelationPushDown.scala
##########
@@ -209,6 +210,11 @@ object V2ScanRelationPushDown extends Rule[LogicalPlan] with PredicateHelper {
       }
   }
 
+  private def supportPartialAggPushDown(agg: Aggregation): Boolean = {
+    // We don't know the agg buffer of `GeneralAggregateFunc`, so can't do partial agg push down.
+    agg.aggregateExpressions().exists(_.isInstanceOf[GeneralAggregateFunc])

Review comment:
       ```suggestion
       !agg.aggregateExpressions().exists(_.isInstanceOf[GeneralAggregateFunc])
   ```




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


[GitHub] [spark] c21 commented on pull request #35070: [SPARK-37789][SQL] Add a class to represent general aggregate functions in DS V2

Posted by GitBox <gi...@apache.org>.
c21 commented on pull request #35070:
URL: https://github.com/apache/spark/pull/35070#issuecomment-1003829174


   Thanks for @cloud-fan to clean this up!


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


[GitHub] [spark] cloud-fan commented on a change in pull request #35070: [SPARK-37789][SQL] Add a class to represent general aggregate functions in DS V2

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #35070:
URL: https://github.com/apache/spark/pull/35070#discussion_r776925992



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceStrategy.scala
##########
@@ -717,8 +717,10 @@ object DataSourceStrategy
               Some(new Count(FieldReference(name), agg.isDistinct))
             case _ => None
           }
-        case sum @ aggregate.Sum(PushableColumnWithoutNestedColumn(name), _) =>
+        case aggregate.Sum(PushableColumnWithoutNestedColumn(name), _) =>
           Some(new Sum(FieldReference(name), agg.isDistinct))
+        case aggregate.Average(PushableColumnWithoutNestedColumn(name), _) =>

Review comment:
       where is `completePushdown` defined?




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


[GitHub] [spark] cloud-fan commented on a change in pull request #35070: [SPARK-37789][SQL] Add a class to represent general aggregate functions in DS V2

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #35070:
URL: https://github.com/apache/spark/pull/35070#discussion_r776766407



##########
File path: sql/catalyst/src/main/java/org/apache/spark/sql/connector/expressions/Expression.java
##########
@@ -29,5 +29,5 @@
   /**
    * Format the expression as a human readable SQL-like string.
    */
-  String describe();
+  default String describe() { return this.toString(); }

Review comment:
       I realized that almost all the implementations override both `toString` and `describe`, so making this change to make it simpler.




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


[GitHub] [spark] beliefer commented on a change in pull request #35070: [SPARK-37789][SQL] Add a class to represent general aggregate functions in DS V2

Posted by GitBox <gi...@apache.org>.
beliefer commented on a change in pull request #35070:
URL: https://github.com/apache/spark/pull/35070#discussion_r776928832



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/jdbc/JdbcDialects.scala
##########
@@ -219,7 +219,11 @@ abstract class JdbcDialect extends Serializable with Logging{
         val column = quoteIdentifier(sum.column.fieldNames.head)
         Some(s"SUM($distinct$column)")
       case _: CountStar =>
-        Some(s"COUNT(*)")
+        Some("COUNT(*)")

Review comment:
       OK




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


[GitHub] [spark] c21 commented on a change in pull request #35070: [SPARK-37789][SQL] Add a class to represent general aggregate functions in DS V2

Posted by GitBox <gi...@apache.org>.
c21 commented on a change in pull request #35070:
URL: https://github.com/apache/spark/pull/35070#discussion_r777274117



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/V2ScanRelationPushDown.scala
##########
@@ -209,6 +210,11 @@ object V2ScanRelationPushDown extends Rule[LogicalPlan] with PredicateHelper {
       }
   }
 
+  private def supportPartialAggPushDown(agg: Aggregation): Boolean = {
+    // We don't know the agg buffer of `GeneralAggregateFunc`, so can't do partial agg push down.
+    agg.aggregateExpressions().exists(_.isInstanceOf[GeneralAggregateFunc])

Review comment:
       +1 Looks like a bug. Shall we also add a unit test?




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


[GitHub] [spark] cloud-fan closed pull request #35070: [SPARK-37789][SQL] Add a class to represent general aggregate functions in DS V2

Posted by GitBox <gi...@apache.org>.
cloud-fan closed pull request #35070:
URL: https://github.com/apache/spark/pull/35070


   


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


[GitHub] [spark] huaxingao commented on a change in pull request #35070: [SPARK-37789][SQL] Add a class to represent general aggregate functions in DS V2

Posted by GitBox <gi...@apache.org>.
huaxingao commented on a change in pull request #35070:
URL: https://github.com/apache/spark/pull/35070#discussion_r776913140



##########
File path: sql/catalyst/src/main/java/org/apache/spark/sql/connector/read/SupportsPushDownAggregates.java
##########
@@ -22,18 +22,19 @@
 
 /**
  * A mix-in interface for {@link ScanBuilder}. Data sources can implement this interface to
- * push down aggregates. Spark assumes that the data source can't fully complete the
- * grouping work, and will group the data source output again. For queries like
- * "SELECT min(value) AS m FROM t GROUP BY key", after pushing down the aggregate
- * to the data source, the data source can still output data with duplicated keys, which is OK
- * as Spark will do GROUP BY key again. The final query plan can be something like this:
+ * push down aggregates.
+ * <p>
+ * If the data source can't fully complete the grouping work, then
+ * {@link #supportCompletePushDown()} should return false, and Spark will group the data source
+ * output again. For queries like "SELECT min(value) AS m FROM t GROUP BY key", after pushing down
+ * the aggregate to the data source, the data source can still output data with duplicated keys,
+ * which is OK as Spark will do GROUP BY key again. The final query plan can be something like this:
  * <pre>
- *   Aggregate [key#1], [min(min(value)#2) AS m#3]
- *     +- RelationV2[key#1, min(value)#2]
+ *   Aggregate [key#1], [min(min_value#2) AS m#3]
+ *     +- RelationV2[key#1, min_value#2]

Review comment:
       I think it is `min(value)#2`?




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


[GitHub] [spark] codecov-commenter edited a comment on pull request #35070: [SPARK-37789][SQL] Add a class to represent general aggregate functions in DS V2

Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #35070:
URL: https://github.com/apache/spark/pull/35070#issuecomment-1003344562


   # [Codecov](https://codecov.io/gh/apache/spark/pull/35070?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#35070](https://codecov.io/gh/apache/spark/pull/35070?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (fe73039) into [master](https://codecov.io/gh/apache/spark/commit/77e868372a4ec037a8eb4e5f76c5d5db325d49a4?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (77e8683) will **increase** coverage by `7.67%`.
   > The diff coverage is `100.00%`.
   
   > :exclamation: Current head fe73039 differs from pull request most recent head 127e412. Consider uploading reports for the commit 127e412 to get more accurate results
   [![Impacted file tree graph](https://codecov.io/gh/apache/spark/pull/35070/graphs/tree.svg?width=650&height=150&src=pr&token=R9pHLWgWi8&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/spark/pull/35070?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #35070      +/-   ##
   ==========================================
   + Coverage   83.74%   91.42%   +7.67%     
   ==========================================
     Files         257      297      +40     
     Lines       57783    63508    +5725     
     Branches     9351     9962     +611     
   ==========================================
   + Hits        48392    58061    +9669     
   + Misses       8207     4103    -4104     
   - Partials     1184     1344     +160     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | unittests | `91.39% <100.00%> (+7.67%)` | :arrow_up: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/spark/pull/35070?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [python/pyspark/sql/functions.py](https://codecov.io/gh/apache/spark/pull/35070/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHl0aG9uL3B5c3Bhcmsvc3FsL2Z1bmN0aW9ucy5weQ==) | `91.27% <100.00%> (+0.02%)` | :arrow_up: |
   | [python/pyspark/sql/tests/test\_functions.py](https://codecov.io/gh/apache/spark/pull/35070/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHl0aG9uL3B5c3Bhcmsvc3FsL3Rlc3RzL3Rlc3RfZnVuY3Rpb25zLnB5) | `98.98% <100.00%> (+0.03%)` | :arrow_up: |
   | [python/pyspark/streaming/kinesis.py](https://codecov.io/gh/apache/spark/pull/35070/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHl0aG9uL3B5c3Bhcmsvc3RyZWFtaW5nL2tpbmVzaXMucHk=) | `55.55% <0.00%> (ø)` | |
   | [python/pyspark/tests/test\_taskcontext.py](https://codecov.io/gh/apache/spark/pull/35070/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHl0aG9uL3B5c3BhcmsvdGVzdHMvdGVzdF90YXNrY29udGV4dC5weQ==) | `96.80% <0.00%> (ø)` | |
   | [python/pyspark/tests/test\_serializers.py](https://codecov.io/gh/apache/spark/pull/35070/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHl0aG9uL3B5c3BhcmsvdGVzdHMvdGVzdF9zZXJpYWxpemVycy5weQ==) | `98.78% <0.00%> (ø)` | |
   | [python/pyspark/tests/test\_readwrite.py](https://codecov.io/gh/apache/spark/pull/35070/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHl0aG9uL3B5c3BhcmsvdGVzdHMvdGVzdF9yZWFkd3JpdGUucHk=) | `100.00% <0.00%> (ø)` | |
   | [python/pyspark/ml/tests/test\_linalg.py](https://codecov.io/gh/apache/spark/pull/35070/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHl0aG9uL3B5c3BhcmsvbWwvdGVzdHMvdGVzdF9saW5hbGcucHk=) | `97.00% <0.00%> (ø)` | |
   | [python/pyspark/streaming/tests/test\_dstream.py](https://codecov.io/gh/apache/spark/pull/35070/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHl0aG9uL3B5c3Bhcmsvc3RyZWFtaW5nL3Rlc3RzL3Rlc3RfZHN0cmVhbS5weQ==) | `95.01% <0.00%> (ø)` | |
   | [python/pyspark/tests/test\_install\_spark.py](https://codecov.io/gh/apache/spark/pull/35070/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHl0aG9uL3B5c3BhcmsvdGVzdHMvdGVzdF9pbnN0YWxsX3NwYXJrLnB5) | `93.87% <0.00%> (ø)` | |
   | [python/pyspark/ml/tests/test\_evaluation.py](https://codecov.io/gh/apache/spark/pull/35070/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHl0aG9uL3B5c3BhcmsvbWwvdGVzdHMvdGVzdF9ldmFsdWF0aW9uLnB5) | `94.44% <0.00%> (ø)` | |
   | ... and [81 more](https://codecov.io/gh/apache/spark/pull/35070/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/spark/pull/35070?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/spark/pull/35070?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [4c58f12...127e412](https://codecov.io/gh/apache/spark/pull/35070?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


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


[GitHub] [spark] cloud-fan commented on a change in pull request #35070: [SPARK-37789][SQL] Add a class to represent general aggregate functions in DS V2

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #35070:
URL: https://github.com/apache/spark/pull/35070#discussion_r776928453



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceStrategy.scala
##########
@@ -717,8 +717,10 @@ object DataSourceStrategy
               Some(new Count(FieldReference(name), agg.isDistinct))
             case _ => None
           }
-        case sum @ aggregate.Sum(PushableColumnWithoutNestedColumn(name), _) =>
+        case aggregate.Sum(PushableColumnWithoutNestedColumn(name), _) =>
           Some(new Sum(FieldReference(name), agg.isDistinct))
+        case aggregate.Average(PushableColumnWithoutNestedColumn(name), _) =>

Review comment:
       It's not available here.




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


[GitHub] [spark] cloud-fan commented on a change in pull request #35070: [SPARK-37789][SQL] Add a class to represent general aggregate functions in DS V2

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #35070:
URL: https://github.com/apache/spark/pull/35070#discussion_r776926140



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/V2ScanRelationPushDown.scala
##########
@@ -282,7 +288,7 @@ object V2ScanRelationPushDown extends Rule[LogicalPlan] with PredicateHelper {
       }
       operation
     case s @ Sort(order, _, operation @ ScanOperation(_, filter, sHolder: ScanBuilderHolder))
-      if filter.isEmpty =>
+        if filter.isEmpty =>

Review comment:
       it should be 4 spaces. You can check it out in other code files.




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


[GitHub] [spark] cloud-fan commented on pull request #35070: [SPARK-37789][SQL] Add a class to represent general aggregate functions in DS V2

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on pull request #35070:
URL: https://github.com/apache/spark/pull/35070#issuecomment-1004646431


   thanks for review, merging to master!


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


[GitHub] [spark] huaxingao commented on a change in pull request #35070: [SPARK-37789][SQL] Add a class to represent general aggregate functions in DS V2

Posted by GitBox <gi...@apache.org>.
huaxingao commented on a change in pull request #35070:
URL: https://github.com/apache/spark/pull/35070#discussion_r777292801



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/V2ScanRelationPushDown.scala
##########
@@ -209,6 +210,11 @@ object V2ScanRelationPushDown extends Rule[LogicalPlan] with PredicateHelper {
       }
   }
 
+  private def supportPartialAggPushDown(agg: Aggregation): Boolean = {
+    // We don't know the agg buffer of `GeneralAggregateFunc`, so can't do partial agg push down.
+    agg.aggregateExpressions().exists(_.isInstanceOf[GeneralAggregateFunc])

Review comment:
       The original code was correct. 
   We probably want to add a test that has `avg` and multiple partitions to cover the case of `!supportPartialAggPushDown`  and `!supportCompletePushDown`




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


[GitHub] [spark] codecov-commenter commented on pull request #35070: [SPARK-37789][SQL] Add a class to represent general aggregate functions in DS V2

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on pull request #35070:
URL: https://github.com/apache/spark/pull/35070#issuecomment-1003344562


   # [Codecov](https://codecov.io/gh/apache/spark/pull/35070?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#35070](https://codecov.io/gh/apache/spark/pull/35070?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (fe73039) into [master](https://codecov.io/gh/apache/spark/commit/77e868372a4ec037a8eb4e5f76c5d5db325d49a4?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (77e8683) will **decrease** coverage by `17.62%`.
   > The diff coverage is `33.33%`.
   
   > :exclamation: Current head fe73039 differs from pull request most recent head 127e412. Consider uploading reports for the commit 127e412 to get more accurate results
   [![Impacted file tree graph](https://codecov.io/gh/apache/spark/pull/35070/graphs/tree.svg?width=650&height=150&src=pr&token=R9pHLWgWi8&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/spark/pull/35070?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@             Coverage Diff             @@
   ##           master   #35070       +/-   ##
   ===========================================
   - Coverage   83.74%   66.12%   -17.63%     
   ===========================================
     Files         257      159       -98     
     Lines       57783    41411    -16372     
     Branches     9351     6904     -2447     
   ===========================================
   - Hits        48392    27384    -21008     
   - Misses       8207    13088     +4881     
   + Partials     1184      939      -245     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | unittests | `66.12% <33.33%> (-17.61%)` | :arrow_down: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/spark/pull/35070?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [python/pyspark/sql/functions.py](https://codecov.io/gh/apache/spark/pull/35070/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHl0aG9uL3B5c3Bhcmsvc3FsL2Z1bmN0aW9ucy5weQ==) | `47.21% <33.33%> (-44.04%)` | :arrow_down: |
   | [python/pyspark/pandas/categorical.py](https://codecov.io/gh/apache/spark/pull/35070/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHl0aG9uL3B5c3BhcmsvcGFuZGFzL2NhdGVnb3JpY2FsLnB5) | `18.45% <0.00%> (-75.60%)` | :arrow_down: |
   | [python/pyspark/pandas/strings.py](https://codecov.io/gh/apache/spark/pull/35070/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHl0aG9uL3B5c3BhcmsvcGFuZGFzL3N0cmluZ3MucHk=) | `25.60% <0.00%> (-72.32%)` | :arrow_down: |
   | [python/pyspark/sql/observation.py](https://codecov.io/gh/apache/spark/pull/35070/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHl0aG9uL3B5c3Bhcmsvc3FsL29ic2VydmF0aW9uLnB5) | `26.08% <0.00%> (-69.57%)` | :arrow_down: |
   | [python/pyspark/pandas/plot/core.py](https://codecov.io/gh/apache/spark/pull/35070/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHl0aG9uL3B5c3BhcmsvcGFuZGFzL3Bsb3QvY29yZS5weQ==) | `21.45% <0.00%> (-68.43%)` | :arrow_down: |
   | [python/pyspark/mllib/linalg/\_\_init\_\_.py](https://codecov.io/gh/apache/spark/pull/35070/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHl0aG9uL3B5c3BhcmsvbWxsaWIvbGluYWxnL19faW5pdF9fLnB5) | `21.57% <0.00%> (-63.29%)` | :arrow_down: |
   | [python/pyspark/pandas/data\_type\_ops/binary\_ops.py](https://codecov.io/gh/apache/spark/pull/35070/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHl0aG9uL3B5c3BhcmsvcGFuZGFzL2RhdGFfdHlwZV9vcHMvYmluYXJ5X29wcy5weQ==) | `38.00% <0.00%> (-62.00%)` | :arrow_down: |
   | [python/pyspark/cloudpickle/compat.py](https://codecov.io/gh/apache/spark/pull/35070/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHl0aG9uL3B5c3BhcmsvY2xvdWRwaWNrbGUvY29tcGF0LnB5) | `30.00% <0.00%> (-60.00%)` | :arrow_down: |
   | [python/pyspark/pandas/sql\_formatter.py](https://codecov.io/gh/apache/spark/pull/35070/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHl0aG9uL3B5c3BhcmsvcGFuZGFzL3NxbF9mb3JtYXR0ZXIucHk=) | `29.26% <0.00%> (-59.76%)` | :arrow_down: |
   | [...on/pyspark/pandas/data\_type\_ops/categorical\_ops.py](https://codecov.io/gh/apache/spark/pull/35070/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHl0aG9uL3B5c3BhcmsvcGFuZGFzL2RhdGFfdHlwZV9vcHMvY2F0ZWdvcmljYWxfb3BzLnB5) | `41.17% <0.00%> (-58.83%)` | :arrow_down: |
   | ... and [190 more](https://codecov.io/gh/apache/spark/pull/35070/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/spark/pull/35070?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/spark/pull/35070?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [4c58f12...127e412](https://codecov.io/gh/apache/spark/pull/35070?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


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


[GitHub] [spark] beliefer commented on a change in pull request #35070: [SPARK-37789][SQL] Add a class to represent general aggregate functions in DS V2

Posted by GitBox <gi...@apache.org>.
beliefer commented on a change in pull request #35070:
URL: https://github.com/apache/spark/pull/35070#discussion_r776928044



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceStrategy.scala
##########
@@ -717,8 +717,10 @@ object DataSourceStrategy
               Some(new Count(FieldReference(name), agg.isDistinct))
             case _ => None
           }
-        case sum @ aggregate.Sum(PushableColumnWithoutNestedColumn(name), _) =>
+        case aggregate.Sum(PushableColumnWithoutNestedColumn(name), _) =>
           Some(new Sum(FieldReference(name), agg.isDistinct))
+        case aggregate.Average(PushableColumnWithoutNestedColumn(name), _) =>

Review comment:
       The value of `supportCompletePushDown()`




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


[GitHub] [spark] cloud-fan commented on a change in pull request #35070: [SPARK-37789][SQL] Add a class to represent general aggregate functions in DS V2

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #35070:
URL: https://github.com/apache/spark/pull/35070#discussion_r776925843



##########
File path: sql/catalyst/src/main/java/org/apache/spark/sql/connector/read/SupportsPushDownAggregates.java
##########
@@ -22,18 +22,19 @@
 
 /**
  * A mix-in interface for {@link ScanBuilder}. Data sources can implement this interface to
- * push down aggregates. Spark assumes that the data source can't fully complete the
- * grouping work, and will group the data source output again. For queries like
- * "SELECT min(value) AS m FROM t GROUP BY key", after pushing down the aggregate
- * to the data source, the data source can still output data with duplicated keys, which is OK
- * as Spark will do GROUP BY key again. The final query plan can be something like this:
+ * push down aggregates.
+ * <p>
+ * If the data source can't fully complete the grouping work, then
+ * {@link #supportCompletePushDown()} should return false, and Spark will group the data source
+ * output again. For queries like "SELECT min(value) AS m FROM t GROUP BY key", after pushing down
+ * the aggregate to the data source, the data source can still output data with duplicated keys,
+ * which is OK as Spark will do GROUP BY key again. The final query plan can be something like this:
  * <pre>
- *   Aggregate [key#1], [min(min(value)#2) AS m#3]
- *     +- RelationV2[key#1, min(value)#2]
+ *   Aggregate [key#1], [min(min_value#2) AS m#3]
+ *     +- RelationV2[key#1, min_value#2]

Review comment:
       It's actually decided by the data source, and I pick `min_value` to make it more readable.




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


[GitHub] [spark] cloud-fan commented on a change in pull request #35070: [SPARK-37789][SQL] Add a class to represent general aggregate functions in DS V2

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #35070:
URL: https://github.com/apache/spark/pull/35070#discussion_r776926223



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/jdbc/JdbcDialects.scala
##########
@@ -219,7 +219,11 @@ abstract class JdbcDialect extends Serializable with Logging{
         val column = quoteIdentifier(sum.column.fieldNames.head)
         Some(s"SUM($distinct$column)")
       case _: CountStar =>
-        Some(s"COUNT(*)")
+        Some("COUNT(*)")

Review comment:
       doesn't matter. all the cases here put the return value in a new line.




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


[GitHub] [spark] yikf commented on a change in pull request #35070: [SPARK-37789][SQL] Add a class to represent general aggregate functions in DS V2

Posted by GitBox <gi...@apache.org>.
yikf commented on a change in pull request #35070:
URL: https://github.com/apache/spark/pull/35070#discussion_r776954292



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/V2ScanRelationPushDown.scala
##########
@@ -209,6 +210,11 @@ object V2ScanRelationPushDown extends Rule[LogicalPlan] with PredicateHelper {
       }
   }
 
+  private def supportPartialAggPushDown(agg: Aggregation): Boolean = {
+    // We don't know the agg buffer of `GeneralAggregateFunc`, so can't do partial agg push down.
+    agg.aggregateExpressions().exists(_.isInstanceOf[GeneralAggregateFunc])

Review comment:
       emm..., This is broken semantics, Since can't push down if have `GeneralAggregateFunc`, Shall we return false if `agg.aggregateExpressions()` exists `GeneralAggregateFunc`, right?
   
   `!agg.aggregateExpressions().exists(_.isInstanceOf[GeneralAggregateFunc])` or `agg.aggregateExpressions().forall(!_.isInstanceOf[GeneralAggregateFunc])`?




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


[GitHub] [spark] beliefer commented on a change in pull request #35070: [SPARK-37789][SQL] Add a class to represent general aggregate functions in DS V2

Posted by GitBox <gi...@apache.org>.
beliefer commented on a change in pull request #35070:
URL: https://github.com/apache/spark/pull/35070#discussion_r777333508



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/V2ScanRelationPushDown.scala
##########
@@ -209,6 +210,11 @@ object V2ScanRelationPushDown extends Rule[LogicalPlan] with PredicateHelper {
       }
   }
 
+  private def supportPartialAggPushDown(agg: Aggregation): Boolean = {
+    // We don't know the agg buffer of `GeneralAggregateFunc`, so can't do partial agg push down.
+    agg.aggregateExpressions().exists(_.isInstanceOf[GeneralAggregateFunc])

Review comment:
       If exists `GeneralAggregateFunc`, we cannot partial aggregate  push-down and still could complete aggregate  push-down. I think `!agg.aggregateExpressions().exists(_.isInstanceOf[GeneralAggregateFunc])` looks better.




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


[GitHub] [spark] cloud-fan commented on a change in pull request #35070: [SPARK-37789][SQL] Add a class to represent general aggregate functions in DS V2

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #35070:
URL: https://github.com/apache/spark/pull/35070#discussion_r777826178



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/V2ScanRelationPushDown.scala
##########
@@ -209,6 +210,11 @@ object V2ScanRelationPushDown extends Rule[LogicalPlan] with PredicateHelper {
       }
   }
 
+  private def supportPartialAggPushDown(agg: Aggregation): Boolean = {
+    // We don't know the agg buffer of `GeneralAggregateFunc`, so can't do partial agg push down.
+    !agg.aggregateExpressions().exists(_.isInstanceOf[GeneralAggregateFunc])

Review comment:
       ```suggestion
       agg.aggregateExpressions().forall(!_.isInstanceOf[GeneralAggregateFunc])
   ```




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


[GitHub] [spark] beliefer commented on a change in pull request #35070: [SPARK-37789][SQL] Add a class to represent general aggregate functions in DS V2

Posted by GitBox <gi...@apache.org>.
beliefer commented on a change in pull request #35070:
URL: https://github.com/apache/spark/pull/35070#discussion_r776906643



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/V2ScanRelationPushDown.scala
##########
@@ -209,6 +210,11 @@ object V2ScanRelationPushDown extends Rule[LogicalPlan] with PredicateHelper {
       }
   }
 
+  private def supportPartialAggPushDown(agg: Aggregation): Boolean = {
+    // We don't know the agg buffer of `GeneralAggregateFunc`, so can't do partial agg push down.
+    agg.aggregateExpressions().forall(!_.isInstanceOf[GeneralAggregateFunc])

Review comment:
       `agg.aggregateExpressions().exists(_.isInstanceOf[GeneralAggregateFunc])`

##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/connector/expressions/expressions.scala
##########
@@ -88,9 +88,7 @@ private[sql] abstract class SingleColumnTransform(ref: NamedReference) extends R
 
   override def arguments: Array[Expression] = Array(ref)
 
-  override def describe: String = name + "(" + reference.describe + ")"
-
-  override def toString: String = describe
+  override def toString: String = name + "(" + reference.describe + ")"

Review comment:
       It seems if describe be called, the result will different.

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/jdbc/JdbcDialects.scala
##########
@@ -219,7 +219,11 @@ abstract class JdbcDialect extends Serializable with Logging{
         val column = quoteIdentifier(sum.column.fieldNames.head)
         Some(s"SUM($distinct$column)")
       case _: CountStar =>
-        Some(s"COUNT(*)")
+        Some("COUNT(*)")

Review comment:
       `case _: CountStar => Some("COUNT(*)")` ?

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceStrategy.scala
##########
@@ -717,8 +717,10 @@ object DataSourceStrategy
               Some(new Count(FieldReference(name), agg.isDistinct))
             case _ => None
           }
-        case sum @ aggregate.Sum(PushableColumnWithoutNestedColumn(name), _) =>
+        case aggregate.Sum(PushableColumnWithoutNestedColumn(name), _) =>
           Some(new Sum(FieldReference(name), agg.isDistinct))
+        case aggregate.Average(PushableColumnWithoutNestedColumn(name), _) =>

Review comment:
       Do we need add ` if completePushdown` here? 

##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/V2ScanRelationPushDown.scala
##########
@@ -282,7 +288,7 @@ object V2ScanRelationPushDown extends Rule[LogicalPlan] with PredicateHelper {
       }
       operation
     case s @ Sort(order, _, operation @ ScanOperation(_, filter, sHolder: ScanBuilderHolder))
-      if filter.isEmpty =>
+        if filter.isEmpty =>

Review comment:
       I feel there should be two indent.




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


[GitHub] [spark] cloud-fan commented on pull request #35070: [SPARK-37789][SQL] Add a class to represent general aggregate functions in DS V2

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on pull request #35070:
URL: https://github.com/apache/spark/pull/35070#issuecomment-1003071670


   cc @beliefer @huaxingao 


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


[GitHub] [spark] beliefer commented on a change in pull request #35070: [SPARK-37789][SQL] Add a class to represent general aggregate functions in DS V2

Posted by GitBox <gi...@apache.org>.
beliefer commented on a change in pull request #35070:
URL: https://github.com/apache/spark/pull/35070#discussion_r776928777



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/V2ScanRelationPushDown.scala
##########
@@ -282,7 +288,7 @@ object V2ScanRelationPushDown extends Rule[LogicalPlan] with PredicateHelper {
       }
       operation
     case s @ Sort(order, _, operation @ ScanOperation(_, filter, sHolder: ScanBuilderHolder))
-      if filter.isEmpty =>
+        if filter.isEmpty =>

Review comment:
       Ref: https://github.com/apache/spark/blob/fe73039f991ce2c44bc5bb2dc845c735e6959c14/sql/core/src/main/scala/org/apache/spark/sql/execution/SparkStrategies.scala#L493
   https://github.com/apache/spark/blob/fe73039f991ce2c44bc5bb2dc845c735e6959c14/sql/core/src/main/scala/org/apache/spark/sql/execution/SparkStrategies.scala#L561
   Maybe we could unify the code style.




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


[GitHub] [spark] beliefer commented on a change in pull request #35070: [SPARK-37789][SQL] Add a class to represent general aggregate functions in DS V2

Posted by GitBox <gi...@apache.org>.
beliefer commented on a change in pull request #35070:
URL: https://github.com/apache/spark/pull/35070#discussion_r776928452



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/connector/expressions/expressions.scala
##########
@@ -88,9 +88,7 @@ private[sql] abstract class SingleColumnTransform(ref: NamedReference) extends R
 
   override def arguments: Array[Expression] = Array(ref)
 
-  override def describe: String = name + "(" + reference.describe + ")"
-
-  override def toString: String = describe
+  override def toString: String = name + "(" + reference.describe + ")"

Review comment:
       Oh. I got it.




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


[GitHub] [spark] cloud-fan commented on a change in pull request #35070: [SPARK-37789][SQL] Add a class to represent general aggregate functions in DS V2

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #35070:
URL: https://github.com/apache/spark/pull/35070#discussion_r776925915



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/connector/expressions/expressions.scala
##########
@@ -88,9 +88,7 @@ private[sql] abstract class SingleColumnTransform(ref: NamedReference) extends R
 
   override def arguments: Array[Expression] = Array(ref)
 
-  override def describe: String = name + "(" + reference.describe + ")"
-
-  override def toString: String = describe
+  override def toString: String = name + "(" + reference.describe + ")"

Review comment:
       Can you elaborate?




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


[GitHub] [spark] cloud-fan commented on a change in pull request #35070: [SPARK-37789][SQL] Add a class to represent general aggregate functions in DS V2

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #35070:
URL: https://github.com/apache/spark/pull/35070#discussion_r776928535



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/V2ScanRelationPushDown.scala
##########
@@ -209,6 +210,11 @@ object V2ScanRelationPushDown extends Rule[LogicalPlan] with PredicateHelper {
       }
   }
 
+  private def supportPartialAggPushDown(agg: Aggregation): Boolean = {
+    // We don't know the agg buffer of `GeneralAggregateFunc`, so can't do partial agg push down.
+    agg.aggregateExpressions().forall(!_.isInstanceOf[GeneralAggregateFunc])

Review comment:
       ```suggestion
       agg.aggregateExpressions().exists(_.isInstanceOf[GeneralAggregateFunc])
   ```




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


[GitHub] [spark] codecov-commenter edited a comment on pull request #35070: [SPARK-37789][SQL] Add a class to represent general aggregate functions in DS V2

Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #35070:
URL: https://github.com/apache/spark/pull/35070#issuecomment-1003344562


   # [Codecov](https://codecov.io/gh/apache/spark/pull/35070?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#35070](https://codecov.io/gh/apache/spark/pull/35070?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (fe73039) into [master](https://codecov.io/gh/apache/spark/commit/77e868372a4ec037a8eb4e5f76c5d5db325d49a4?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (77e8683) will **decrease** coverage by `3.38%`.
   > The diff coverage is `33.33%`.
   
   > :exclamation: Current head fe73039 differs from pull request most recent head 127e412. Consider uploading reports for the commit 127e412 to get more accurate results
   [![Impacted file tree graph](https://codecov.io/gh/apache/spark/pull/35070/graphs/tree.svg?width=650&height=150&src=pr&token=R9pHLWgWi8&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/spark/pull/35070?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #35070      +/-   ##
   ==========================================
   - Coverage   83.74%   80.36%   -3.39%     
   ==========================================
     Files         257      200      -57     
     Lines       57783    47130   -10653     
     Branches     9351     7516    -1835     
   ==========================================
   - Hits        48392    37877   -10515     
   + Misses       8207     8041     -166     
   - Partials     1184     1212      +28     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | unittests | `80.35% <33.33%> (-3.38%)` | :arrow_down: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/spark/pull/35070?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [python/pyspark/sql/functions.py](https://codecov.io/gh/apache/spark/pull/35070/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHl0aG9uL3B5c3Bhcmsvc3FsL2Z1bmN0aW9ucy5weQ==) | `48.16% <33.33%> (-43.10%)` | :arrow_down: |
   | [python/pyspark/pandas/categorical.py](https://codecov.io/gh/apache/spark/pull/35070/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHl0aG9uL3B5c3BhcmsvcGFuZGFzL2NhdGVnb3JpY2FsLnB5) | `18.45% <0.00%> (-75.60%)` | :arrow_down: |
   | [python/pyspark/pandas/strings.py](https://codecov.io/gh/apache/spark/pull/35070/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHl0aG9uL3B5c3BhcmsvcGFuZGFzL3N0cmluZ3MucHk=) | `25.60% <0.00%> (-72.32%)` | :arrow_down: |
   | [python/pyspark/sql/observation.py](https://codecov.io/gh/apache/spark/pull/35070/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHl0aG9uL3B5c3Bhcmsvc3FsL29ic2VydmF0aW9uLnB5) | `26.08% <0.00%> (-69.57%)` | :arrow_down: |
   | [python/pyspark/pandas/plot/core.py](https://codecov.io/gh/apache/spark/pull/35070/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHl0aG9uL3B5c3BhcmsvcGFuZGFzL3Bsb3QvY29yZS5weQ==) | `21.45% <0.00%> (-68.43%)` | :arrow_down: |
   | [python/pyspark/pandas/data\_type\_ops/binary\_ops.py](https://codecov.io/gh/apache/spark/pull/35070/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHl0aG9uL3B5c3BhcmsvcGFuZGFzL2RhdGFfdHlwZV9vcHMvYmluYXJ5X29wcy5weQ==) | `38.00% <0.00%> (-62.00%)` | :arrow_down: |
   | [python/pyspark/pandas/sql\_formatter.py](https://codecov.io/gh/apache/spark/pull/35070/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHl0aG9uL3B5c3BhcmsvcGFuZGFzL3NxbF9mb3JtYXR0ZXIucHk=) | `29.26% <0.00%> (-59.76%)` | :arrow_down: |
   | [...on/pyspark/pandas/data\_type\_ops/categorical\_ops.py](https://codecov.io/gh/apache/spark/pull/35070/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHl0aG9uL3B5c3BhcmsvcGFuZGFzL2RhdGFfdHlwZV9vcHMvY2F0ZWdvcmljYWxfb3BzLnB5) | `41.17% <0.00%> (-58.83%)` | :arrow_down: |
   | [python/pyspark/pandas/indexes/category.py](https://codecov.io/gh/apache/spark/pull/35070/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHl0aG9uL3B5c3BhcmsvcGFuZGFzL2luZGV4ZXMvY2F0ZWdvcnkucHk=) | `35.63% <0.00%> (-58.63%)` | :arrow_down: |
   | [python/pyspark/pandas/data\_type\_ops/boolean\_ops.py](https://codecov.io/gh/apache/spark/pull/35070/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHl0aG9uL3B5c3BhcmsvcGFuZGFzL2RhdGFfdHlwZV9vcHMvYm9vbGVhbl9vcHMucHk=) | `37.84% <0.00%> (-58.17%)` | :arrow_down: |
   | ... and [251 more](https://codecov.io/gh/apache/spark/pull/35070/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/spark/pull/35070?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/spark/pull/35070?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [4c58f12...127e412](https://codecov.io/gh/apache/spark/pull/35070?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


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


[GitHub] [spark] codecov-commenter edited a comment on pull request #35070: [SPARK-37789][SQL] Add a class to represent general aggregate functions in DS V2

Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #35070:
URL: https://github.com/apache/spark/pull/35070#issuecomment-1003344562


   # [Codecov](https://codecov.io/gh/apache/spark/pull/35070?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#35070](https://codecov.io/gh/apache/spark/pull/35070?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (fe73039) into [master](https://codecov.io/gh/apache/spark/commit/77e868372a4ec037a8eb4e5f76c5d5db325d49a4?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (77e8683) will **increase** coverage by `2.49%`.
   > The diff coverage is `33.33%`.
   
   > :exclamation: Current head fe73039 differs from pull request most recent head 127e412. Consider uploading reports for the commit 127e412 to get more accurate results
   [![Impacted file tree graph](https://codecov.io/gh/apache/spark/pull/35070/graphs/tree.svg?width=650&height=150&src=pr&token=R9pHLWgWi8&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/spark/pull/35070?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #35070      +/-   ##
   ==========================================
   + Coverage   83.74%   86.24%   +2.49%     
   ==========================================
     Files         257      253       -4     
     Lines       57783    54888    -2895     
     Branches     9351     8977     -374     
   ==========================================
   - Hits        48392    47336    -1056     
   + Misses       8207     6290    -1917     
   - Partials     1184     1262      +78     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | unittests | `86.21% <33.33%> (+2.48%)` | :arrow_up: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/spark/pull/35070?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [python/pyspark/sql/functions.py](https://codecov.io/gh/apache/spark/pull/35070/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHl0aG9uL3B5c3Bhcmsvc3FsL2Z1bmN0aW9ucy5weQ==) | `51.24% <33.33%> (-40.02%)` | :arrow_down: |
   | [python/pyspark/sql/observation.py](https://codecov.io/gh/apache/spark/pull/35070/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHl0aG9uL3B5c3Bhcmsvc3FsL29ic2VydmF0aW9uLnB5) | `26.08% <0.00%> (-69.57%)` | :arrow_down: |
   | [python/pyspark/mllib/linalg/\_\_init\_\_.py](https://codecov.io/gh/apache/spark/pull/35070/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHl0aG9uL3B5c3BhcmsvbWxsaWIvbGluYWxnL19faW5pdF9fLnB5) | `28.66% <0.00%> (-56.20%)` | :arrow_down: |
   | [python/pyspark/sql/streaming.py](https://codecov.io/gh/apache/spark/pull/35070/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHl0aG9uL3B5c3Bhcmsvc3FsL3N0cmVhbWluZy5weQ==) | `27.03% <0.00%> (-54.95%)` | :arrow_down: |
   | [python/pyspark/mllib/regression.py](https://codecov.io/gh/apache/spark/pull/35070/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHl0aG9uL3B5c3BhcmsvbWxsaWIvcmVncmVzc2lvbi5weQ==) | `38.88% <0.00%> (-53.89%)` | :arrow_down: |
   | [python/pyspark/sql/sql\_formatter.py](https://codecov.io/gh/apache/spark/pull/35070/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHl0aG9uL3B5c3Bhcmsvc3FsL3NxbF9mb3JtYXR0ZXIucHk=) | `32.50% <0.00%> (-52.50%)` | :arrow_down: |
   | [python/pyspark/mllib/stat/\_statistics.py](https://codecov.io/gh/apache/spark/pull/35070/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHl0aG9uL3B5c3BhcmsvbWxsaWIvc3RhdC9fc3RhdGlzdGljcy5weQ==) | `34.24% <0.00%> (-52.06%)` | :arrow_down: |
   | [python/pyspark/sql/pandas/group\_ops.py](https://codecov.io/gh/apache/spark/pull/35070/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHl0aG9uL3B5c3Bhcmsvc3FsL3BhbmRhcy9ncm91cF9vcHMucHk=) | `43.10% <0.00%> (-48.28%)` | :arrow_down: |
   | [python/pyspark/sql/pandas/map\_ops.py](https://codecov.io/gh/apache/spark/pull/35070/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHl0aG9uL3B5c3Bhcmsvc3FsL3BhbmRhcy9tYXBfb3BzLnB5) | `40.54% <0.00%> (-45.95%)` | :arrow_down: |
   | [python/pyspark/sql/catalog.py](https://codecov.io/gh/apache/spark/pull/35070/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHl0aG9uL3B5c3Bhcmsvc3FsL2NhdGFsb2cucHk=) | `46.35% <0.00%> (-45.04%)` | :arrow_down: |
   | ... and [155 more](https://codecov.io/gh/apache/spark/pull/35070/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/spark/pull/35070?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/spark/pull/35070?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [4c58f12...127e412](https://codecov.io/gh/apache/spark/pull/35070?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


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


[GitHub] [spark] beliefer commented on a change in pull request #35070: [SPARK-37789][SQL] Add a class to represent general aggregate functions in DS V2

Posted by GitBox <gi...@apache.org>.
beliefer commented on a change in pull request #35070:
URL: https://github.com/apache/spark/pull/35070#discussion_r777333508



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/V2ScanRelationPushDown.scala
##########
@@ -209,6 +210,11 @@ object V2ScanRelationPushDown extends Rule[LogicalPlan] with PredicateHelper {
       }
   }
 
+  private def supportPartialAggPushDown(agg: Aggregation): Boolean = {
+    // We don't know the agg buffer of `GeneralAggregateFunc`, so can't do partial agg push down.
+    agg.aggregateExpressions().exists(_.isInstanceOf[GeneralAggregateFunc])

Review comment:
       If exists `GeneralAggregateFunc`, we cannot partial aggregate  push-down and still could complete aggregate  push-down. I think the code is correct and is not a bug.




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