cloud-fan commented on a change in pull request #31679:
URL: https://github.com/apache/spark/pull/31679#discussion_r587243095
##########
File path:
sql/core/src/test/scala/org/apache/spark/sql/execution/metric/SQLMetricsSuite.scala
##########
@@ -782,4 +783,20 @@ class SQLMetricsSuite extends SharedSparkSession with
SQLMetricsTestUtils
}
}
}
+
+ test("SPARK-34567: Add metrics for CreateTableAsSelectCommand") {
+ withTable("t") {
+ val df = sql("CREATE TABLE t USING PARQUET AS SELECT 1 as a")
+ val dataWritingCommandExec =
+ df.queryExecution.executedPlan.asInstanceOf[DataWritingCommandExec]
+ dataWritingCommandExec.executeCollect()
+ val createTableAsSelect = dataWritingCommandExec.cmd
+ assert(createTableAsSelect.metrics.contains("numFiles"))
+ assert(createTableAsSelect.metrics("numFiles").value == 1)
+ assert(createTableAsSelect.metrics.contains("numOutputBytes"))
+ assert(createTableAsSelect.metrics("numOutputBytes").value == 437)
Review comment:
let's make the test more robust and check
`metrics("numOutputBytes").value > 0`
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]