xuanyuanking commented on a change in pull request #23327: [SPARK-26222][SQL]
Track file listing time
URL: https://github.com/apache/spark/pull/23327#discussion_r242076144
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/DataSourceScanExec.scala
##########
@@ -167,28 +167,30 @@ case class FileSourceScanExec(
partitionSchema = relation.partitionSchema,
relation.sparkSession.sessionState.conf)
- val driverMetrics: HashMap[String, Long] = HashMap.empty
-
/**
* Send the driver-side metrics. Before calling this function,
selectedPartitions has
* been initialized. See SPARK-26327 for more details.
*/
private def sendDriverMetrics(): Unit = {
+ val driverMetrics: HashMap[String, Long] = HashMap.empty
+
+ driverMetrics("numFiles") = selectedPartitions.map(_.files.size.toLong).sum
+ val fileListingPhase = relation.location.fileListingPhase
+ if (fileListingPhase.isDefined) {
+ val phase = fileListingPhase.get
+ driverMetrics("metadataTime") = phase.durationMs
Review comment:
As discussion with @gatorsmile, `metadataTime` maybe still a clearer name
for users, change it back in b79e948.
As my current plan, we'll finally get five metrics as below:
- "metadata time": including all metadata accessing time like file listing
time, meta store time and others.
- "file listing start/end": the start and end timestamp for file listing
- "metastore operation start/end": the start and end timestamp for metastore
operation.
Currently, the file listing start and end still contains part of partition
pruning time(introduced from
[SPARK-20151](https://github.com/apache/spark/pull/17476/files)), I think we
should split the partition pruning time into `metastore operation time`, which
will be done in https://issues.apache.org/jira/browse/SPARK-26223.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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]