karuppayya commented on code in PR #52595:
URL: https://github.com/apache/spark/pull/52595#discussion_r2446232487
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/WriteToDataSourceV2Exec.scala:
##########
@@ -480,10 +480,20 @@ trait V2TableWriteExec extends V2CommandExec with
UnaryExecNode with AdaptiveSpa
Nil
}
- private def getOperationMetrics(query: SparkPlan): util.Map[String,
lang.Long] = {
- collectFirst(query) { case m: MergeRowsExec => m }.map{ n =>
- n.metrics.map { case (name, metric) => s"merge.$name" ->
lang.Long.valueOf(metric.value) }
- }.getOrElse(Map.empty[String, lang.Long]).asJava
+ private def getWriterMetrics(query: SparkPlan): Option[WriterMetrics] = {
+ collectFirst(query) { case m: MergeRowsExec => m }.map { n =>
+ val metrics = n.metrics
+ MergeMetricsImpl(
Review Comment:
I meant to say this
```
private[sql] case class MergeMetricsImpl(metricMap: Map[String, SQLMetric])
extends MergeMetrics {
override def numTargetRowsCopied(): Long =
metricMap.get("numTargetRowsCopied").map(_.value).getOrElse(-1L)
...
}
```
But I guess it might not be possible since `SQLMetric` is not accessible in
sql/catalyst
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]