hvanhovell commented on a change in pull request #25264:
[SPARK-28213][SQL][followup] code cleanup and bug fix for columnar execution
framework
URL: https://github.com/apache/spark/pull/25264#discussion_r309861632
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/DataSourceScanExec.scala
##########
@@ -334,37 +334,63 @@ case class FileSourceScanExec(
inputRDD :: Nil
}
- override lazy val metrics =
- Map("numOutputRows" -> SQLMetrics.createMetric(sparkContext, "number of
output rows"),
- "numFiles" -> SQLMetrics.createMetric(sparkContext, "number of files
read"),
- "metadataTime" -> SQLMetrics.createTimingMetric(sparkContext, "metadata
time"),
- "scanTime" -> SQLMetrics.createTimingMetric(sparkContext, "scan time"))
+ override lazy val metrics = Map(
+ "numOutputRows" -> SQLMetrics.createMetric(sparkContext, "number of output
rows"),
+ "numFiles" -> SQLMetrics.createMetric(sparkContext, "number of files
read"),
+ "metadataTime" -> SQLMetrics.createTimingMetric(sparkContext, "metadata
time"),
+ "scanTime" -> SQLMetrics.createTimingMetric(sparkContext, "scan time"))
+
+ private abstract class ScanTimeTrackingIterator[T](
+ fileScanIterator: Iterator[T],
+ scanTimeMetrics: SQLMetric) extends Iterator[T] {
+
+ override def hasNext: Boolean = {
+ // The `FileScanRDD` returns an iterator which scans the file during the
`hasNext` call.
Review comment:
Calling `System.nanoTime()` per tuple isn't exactly cheap. This probably
regresses cases where the scan produces rows instead of batches. I am actually
not sure if there is an (easy) way around this.
----------------------------------------------------------------
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]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]