yabola commented on code in PR #39950:
URL: https://github.com/apache/spark/pull/39950#discussion_r1143531801


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/parquet/ParquetPartitionReaderFactory.scala:
##########
@@ -88,12 +88,18 @@ case class ParquetPartitionReaderFactory(
   private def getFooter(file: PartitionedFile): ParquetMetadata = {
     val conf = broadcastedConf.value.value
     val filePath = file.toPath
+    val split = new FileSplit(file.toPath, file.start, file.length, 
Array.empty[String])
 
-    if (aggregation.isEmpty) {
-      ParquetFooterReader.readFooter(conf, filePath, SKIP_ROW_GROUPS)
-    } else {
+    if (aggregation.isDefined) {
       // For aggregate push down, we will get max/min/count from footer 
statistics.
       ParquetFooterReader.readFooter(conf, filePath, NO_FILTER)
+    } else if (enableVectorizedReader) {
+      // This can avoid reading the footer twice(currently only optimize for 
vectorized read).
+      // Read all the row groups in advance and filter the row groups later if 
there are
+      // filters that need push down.
+      ParquetFooterReader.readFooter(conf, split, 
ParquetFooterReader.WITH_ROW_GROUPS)
+    } else {

Review Comment:
   I think we can use 
   ```java
   if (aggregation.isDefined || enableVectorizedReader) {
   ParquetFooterReader.readFooter(conf, split, 
ParquetFooterReader.WITH_ROW_GROUPS)
   }
   ```



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

Reply via email to