sarutak opened a new pull request #25280: [SPARK-28548][SQL] explain() shows 
wrong result for persisted DataFrames after some operations
URL: https://github.com/apache/spark/pull/25280
 
 
   ## What changes were proposed in this pull request?
   
   After some operations against Datasets and then persist them, 
Dataset.explain shows wrong result.
   One of those operations is explain() itself.
   An example here.
   
   ```
   val df = spark.range(10)
   df.explain
   df.persist
   df.explain
   ```
   
   Expected result is like as follows.
   ```
   == Physical Plan ==
   *(1) ColumnarToRow
   +- InMemoryTableScan [id#7L]
         +- InMemoryRelation [id#7L], StorageLevel(disk, memory, deserialized, 
1 replicas)
               +- *(1) Range (0, 10, step=1, splits=12)
   ```
   
   But I got this.
   ```
   == Physical Plan ==
   *(1) Range (0, 10, step=1, splits=12)
   ```
   
   This issue is caused by `withCachedData` in `QueryExecution` is materialized 
early when `explain()` or such methods are called so this patch prevents it.
   
   ## How was this patch tested?
   Additional test cases in `ExplainSuite.scala`

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


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to