Github user davies commented on a diff in the pull request:
https://github.com/apache/spark/pull/13701#discussion_r73934292
--- Diff:
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetFileFormat.scala
---
@@ -357,10 +358,27 @@ private[sql] class ParquetFileFormat
val hadoopAttemptContext =
new TaskAttemptContextImpl(broadcastedHadoopConf.value.value,
attemptId)
+ // Try to push down filters when filter push-down is enabled.
+ // Notice: This push-down is RowGroups level, not individual records.
+ if (pushed.isDefined) {
+
ParquetInputFormat.setFilterPredicate(hadoopAttemptContext.getConfiguration,
pushed.get)
+ }
val parquetReader = if (enableVectorizedReader) {
val vectorizedReader = new VectorizedParquetRecordReader()
vectorizedReader.initialize(split, hadoopAttemptContext)
logDebug(s"Appending $partitionSchema ${file.partitionValues}")
+
+ // For test purpose.
+ // If the predefined accumulator exists, the row group number to
read will be updated
+ // to the accumulator. So we can check if the row groups are
filtered or not in test case.
+ val taskContext = TaskContext.get()
+ if (taskContext != null) {
+ val accu =
taskContext.taskMetrics.lookForAccumulatorByName(accuNameForNumRowGroup)
+ if (accu.isDefined) {
+
accu.get.asInstanceOf[SQLMetric].add(vectorizedReader.getRowGroupCount().toLong)
--- End diff --
We could move this into SpecificParquetRecordReaderBase to minimize the
change.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]