huaxingao commented on a change in pull request #32049: URL: https://github.com/apache/spark/pull/32049#discussion_r621751881
########## File path: sql/catalyst/src/main/java/org/apache/spark/sql/connector/read/SupportsPushDownAggregates.java ########## @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.spark.sql.connector.read; + +import org.apache.spark.annotation.Evolving; +import org.apache.spark.sql.sources.Aggregation; + +/** + * A mix-in interface for {@link ScanBuilder}. Data sources can implement this interface to + * push down aggregates to the data source. + * + * @since 3.2.0 + */ +@Evolving +public interface SupportsPushDownAggregates extends ScanBuilder { Review comment: @cloud-fan I quickly tried it out by adding a rule to match Aggregate and V2Relation. I did the following: 1. deleted the `SupportsPushDownAggregates` interface 2. added `pushAggregation` in `Scan` ``` default void pushAggregation(Aggregation aggregation) { throw new UnsupportedOperationException(description() + ": Push down Aggregation is not supported"); } ``` 3. implemented the above method in `ParquetScan` 4. added a rule `PartialAggregatePushDown` in core/sql. I didn't add this in catalyst because I need to access some of the files in core/sql. 5. In `PartialAggregatePushDown`, I only enable the push down if the table in V2Relation is a `ParquetTable`, because I only implemented `pushAggregation` in `ParquetScan` now. Could you please take a look to see if this is what you want? Thank you very much! -- 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]
