Github user cloud-fan commented on a diff in the pull request: https://github.com/apache/spark/pull/16664#discussion_r100049953 --- Diff: sql/core/src/main/scala/org/apache/spark/sql/DataFrameWriter.scala --- @@ -190,6 +193,32 @@ final class DataFrameWriter[T] private[sql](ds: Dataset[T]) { } /** + * Wrap a DataFrameWriter action to track the query execution and time cost, then report to the + * user-registered callback functions. + * + * @param funcName A identifier for the method executing the query + * @param qe the @see `QueryExecution` object associated with the query + * @param outputParams The output parameters useful for query analysis + * @param action the function that executes the query after which the listener methods gets + * called. + */ + private def withAction( + funcName: String, + qe: QueryExecution, + outputParams: OutputParams)(action: => Unit) = { + try { + val start = System.nanoTime() --- End diff -- `Dataset.withAction` will reset metrics of physical plans, shall we do it here? And can we create a general function for both `Dataset` and `DataFrameWriter`?
--- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org