sunchao commented on code in PR #38924: URL: https://github.com/apache/spark/pull/38924#discussion_r1041789809
########## sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/BatchScanExec.scala: ########## @@ -114,8 +117,21 @@ case class BatchScanExec( // return an empty RDD with 1 partition if dynamic filtering removed the only split sparkContext.parallelize(Array.empty[InternalRow], 1) } else { + var finalPartitions = filteredPartitions + + outputPartitioning match { + case p: KeyGroupedPartitioning => + val partitionMapping = finalPartitions.map(s => + s.head.asInstanceOf[HasPartitionKey].partitionKey() -> s).toMap + finalPartitions = p.partitionValuesOpt.get.map { partKey => Review Comment: I was hoping to re-use the logic code in #38950 too, which is not related to runtime filtering. If moving this close to the `if (oldRows.size < newRows.size)` check then I may have to duplicate it somewhere else? ########## sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/BatchScanExec.scala: ########## @@ -114,8 +117,21 @@ case class BatchScanExec( // return an empty RDD with 1 partition if dynamic filtering removed the only split sparkContext.parallelize(Array.empty[InternalRow], 1) } else { + var finalPartitions = filteredPartitions + + outputPartitioning match { + case p: KeyGroupedPartitioning => + val partitionMapping = finalPartitions.map(s => + s.head.asInstanceOf[HasPartitionKey].partitionKey() -> s).toMap + finalPartitions = p.partitionValuesOpt.get.map { partKey => Review Comment: I was hoping to re-use the logic in #38950 too, which is not related to runtime filtering. If moving this close to the `if (oldRows.size < newRows.size)` check then I may have to duplicate it somewhere else? -- 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-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org