Github user cloud-fan commented on a diff in the pull request:
https://github.com/apache/spark/pull/18159#discussion_r124740444
--- Diff:
sql/core/src/main/scala/org/apache/spark/sql/execution/command/commands.scala
---
@@ -19,25 +19,70 @@ package org.apache.spark.sql.execution.command
import java.util.UUID
+import org.apache.spark.SparkContext
import org.apache.spark.rdd.RDD
import org.apache.spark.sql.{Row, SparkSession}
import org.apache.spark.sql.catalyst.{CatalystTypeConverters, InternalRow}
import org.apache.spark.sql.catalyst.errors.TreeNodeException
import org.apache.spark.sql.catalyst.expressions.{Attribute,
AttributeReference}
import org.apache.spark.sql.catalyst.plans.{logical, QueryPlan}
import org.apache.spark.sql.catalyst.plans.logical.LogicalPlan
-import org.apache.spark.sql.execution.SparkPlan
+import org.apache.spark.sql.execution.{SparkPlan, SQLExecution}
+import org.apache.spark.sql.execution.datasources.ExecutedWriteSummary
import org.apache.spark.sql.execution.debug._
+import org.apache.spark.sql.execution.metric.{SQLMetric, SQLMetrics}
import org.apache.spark.sql.execution.streaming.{IncrementalExecution,
OffsetSeqMetadata}
import org.apache.spark.sql.streaming.OutputMode
import org.apache.spark.sql.types._
+import org.apache.spark.util.Utils
/**
* A logical command that is executed for its side-effects.
`RunnableCommand`s are
* wrapped in `ExecutedCommand` during execution.
*/
trait RunnableCommand extends logical.Command {
- def run(sparkSession: SparkSession, children: Seq[SparkPlan]): Seq[Row]
= {
+
+ def metrics(sparkContext: SparkContext): Map[String, SQLMetric] =
Map.empty
+
+ /**
+ * Callback function that update metrics collected from the writing
operation.
+ */
+ private[sql] def prepareMetricsUpdater(
--- End diff --
We can remove this abstraction if we can get the `SparkContext` in logical
plan instead of passing it via `RunnaleCommand.run`. I think this is doable via
`SparkContext.getActive.get`
---
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]