HyukjinKwon opened a new pull request #35968:
URL: https://github.com/apache/spark/pull/35968


   ### What changes were proposed in this pull request?
   
   This PR proposes to show the default index type in SQL plans for pandas API 
on Spark.
   
   Note that this PR does not handle `sequence` case because that's discouraged 
in production, and tricky to insert an alias.
   
   ### Why are the changes needed?
   
   When users set `compute.default_index_type`, it's difficult to know which 
DataFrame users which index. We should at least note that in Spark SQL so users 
can tell which plans are for default index.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes, when users call `pyspark.pandas.DataFrame.spark.explain(True)`:
   
   **distributed**
   
   ```python
   import pyspark.pandas as ps
   ps.set_option("compute.default_index_type", "distributed")
   ps.range(1).spark.explain()
   ```
   
   ```
   == Physical Plan ==
   *(1) Project [distributed_index() AS __index_level_0__#15L, id#13L]
   +- *(1) Range (0, 1, step=1, splits=16)
   ```
   
   **distributed-sequence**
   
   ```python
   import pyspark.pandas as ps
   ps.set_option("compute.default_index_type", "distributed-sequence")
   ps.range(1).spark.explain()
   ```
   
   ```
   == Physical Plan ==
   AttachDistributedSequence[__index_level_0__#16L, id#13L] Index: 
__index_level_0__#16L
   +- *(1) Range (0, 1, step=1, splits=16)
   ```
   
   
   ### How was this patch tested?
   
   
   Manually tested.


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

To unsubscribe, e-mail: [email protected]

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