huaxingao commented on a change in pull request #33650:
URL: https://github.com/apache/spark/pull/33650#discussion_r691733542
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/PushDownUtils.scala
##########
@@ -38,9 +37,9 @@ object PushDownUtils extends PredicateHelper {
* @return pushed filter and post-scan filters.
*/
def pushFilters(
- scanBuilder: ScanBuilder,
+ scanBuilderHolder: ScanBuilderHolder,
Review comment:
because I need the `scanBuilderHolder.relation` for
`DataSourceUtils.getPartitionKeyFiltersAndDataFilters`
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/PushDownUtils.scala
##########
@@ -50,8 +49,17 @@ object PushDownUtils extends PredicateHelper {
val translatedFilters = mutable.ArrayBuffer.empty[sources.Filter]
// Catalyst filter expression that can't be translated to data source
filters.
val untranslatableExprs = mutable.ArrayBuffer.empty[Expression]
+ val dataFilters = r match {
+ case f: FileScanBuilder =>
+ val (partitionFilters, fileDataFilters) =
+ DataSourceUtils.getPartitionKeyFiltersAndDataFilters(
+ f.getSparkSession, scanBuilderHolder.relation,
f.readPartitionSchema(), filters)
+ f.pushPartitionFilters(ExpressionSet(partitionFilters).toSeq,
fileDataFilters)
Review comment:
As per our offline discussion, I have made the following changes:
- make file source v2 NOT implement `SupportsPushdownFilters` any more
- add `pushFiltersToFileIndex` in file source v2. In this method:
- push both Expression partition filters and Expression data filters to
file source.
- data filters are used for filter push down. File source translates the
data filters from `Expression` to `Sources.Filer`, and decides which filters to
push down.
- partition filters are used for partition pruning.
I have updated the PR description accordingly.
--
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]