Skip to content

Commit 182eb79

Browse files
committed
use pattern match to dump file scan metadata
1 parent 82dc3d7 commit 182eb79

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

sql/core/src/main/scala/org/apache/spark/sql/execution/SparkPlan.scala

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,6 @@ abstract class SparkPlan extends QueryPlan[SparkPlan] with Logging with Serializ
7373
super.makeCopy(newArgs)
7474
}
7575

76-
/**
77-
* @return Metadata that describes more details of this SparkPlan.
78-
*/
79-
def metadata: Map[String, String] = Map.empty
80-
8176
/**
8277
* @return All metrics containing metrics of this SparkPlan.
8378
*/

sql/core/src/main/scala/org/apache/spark/sql/execution/SparkPlanInfo.scala

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717

1818
package org.apache.spark.sql.execution
1919

20-
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
21-
2220
import org.apache.spark.annotation.DeveloperApi
2321
import org.apache.spark.sql.execution.exchange.ReusedExchangeExec
2422
import org.apache.spark.sql.execution.metric.SQLMetricInfo
@@ -59,7 +57,12 @@ private[execution] object SparkPlanInfo {
5957
new SQLMetricInfo(metric.name.getOrElse(key), metric.id, metric.metricType)
6058
}
6159

60+
// dump the file scan metadata (e.g file path) to event log
61+
val metadata = plan match {
62+
case fileScan: FileSourceScanExec => fileScan.metadata
63+
case _ => Map[String, String]()
64+
}
6265
new SparkPlanInfo(plan.nodeName, plan.simpleString, children.map(fromSparkPlan),
63-
plan.metadata, metrics)
66+
metadata, metrics)
6467
}
6568
}

0 commit comments

Comments
 (0)