You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2019/12/12 09:11:23 UTC

[GitHub] [spark] HyukjinKwon commented on a change in pull request #26861: [SPARK-30231][SQL][PYTHON] Support explain mode in PySpark df.explain

HyukjinKwon commented on a change in pull request #26861: [SPARK-30231][SQL][PYTHON] Support explain mode in PySpark df.explain
URL: https://github.com/apache/spark/pull/26861#discussion_r357030209
 
 

 ##########
 File path: python/pyspark/sql/dataframe.py
 ##########
 @@ -271,11 +279,38 @@ def explain(self, extended=False):
         ...
         == Physical Plan ==
         ...
+
+        >>> df.explain(mode="formatted")
+        == Physical Plan ==
+        * Scan ExistingRDD (1)
+        <BLANKLINE>
+        <BLANKLINE>
+        (1) Scan ExistingRDD [codegen id : 1]
+        Output: [age#0, name#1]
+        <BLANKLINE>
+        <BLANKLINE>
+
+        .. versionchanged:: 3.0.0
+           Added optional argument `mode` to specify the expected output format of plans.
         """
-        if extended:
-            print(self._jdf.queryExecution().toString())
+        if extended is not None and mode is not None:
+            raise Exception("extended and mode can not be specified simultaneously")
+
+        # Handle a case with no argument first: df.explain()
 
 Review comment:
   Yes .. this case is a bit annoying. There's an example to follow at `sample`.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org