AngersZhuuuu commented on pull request #31679:
URL: https://github.com/apache/spark/pull/31679#issuecomment-787456765


   > Could you add some tests?
   
   I have tried to add UT like 
   ```
    test("SPARK-34567: Add metrics for CreateTableAsSelectCommand") {
       withTable("t") {
         val df = sql("CREATE TABLE t AS SELECT 1 as a")
         df.collect()
         val plan = df.queryExecution.executedPlan
   
         val createTableAsSelect = plan.collect {
           case write: DataWritingCommandExec => write.cmd
         }
   
   
         assert(createTableAsSelect.size === 1)
         assert(createTableAsSelect.head.metrics.contains("numFiles"))
         assert(createTableAsSelect.head.metrics("numFiles").value == 1)
         assert(createTableAsSelect.head.metrics.contains("numOutputBytes"))
         assert(createTableAsSelect.head.metrics("numOutputBytes").value == 2)
         assert(createTableAsSelect.head.metrics.contains("numOutputRows"))
         assert(createTableAsSelect.head.metrics("numOutputRows").value == 1)
       }
     }
   ```
   
   But it's strange that the CreateHiveTableAsSelect command's metrics is not 
updated. I haven't found in which place we lose this information but in SQL 
Tab, we can show the metrics correctly.


----------------------------------------------------------------
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]

Reply via email to