File tree Expand file tree Collapse file tree 1 file changed +20
-3
lines changed Expand file tree Collapse file tree 1 file changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -244,8 +244,25 @@ def explain(self, extended=False):
244
244
debugging purpose.
245
245
246
246
If extended is False, only prints the physical plan.
247
- """
248
- self ._jdf .explain (extended )
247
+
248
+ >>> df.explain()
249
+ PhysicalRDD [age#0,name#1], MapPartitionsRDD[...] at mapPartitions at SQLContext.scala:...
250
+
251
+ >>> df.explain(True)
252
+ == Parsed Logical Plan ==
253
+ ...
254
+ == Analyzed Logical Plan ==
255
+ ...
256
+ == Optimized Logical Plan ==
257
+ ...
258
+ == Physical Plan ==
259
+ ...
260
+ == RDD ==
261
+ """
262
+ if extended :
263
+ print self ._jdf .queryExecution ().toString ()
264
+ else :
265
+ print self ._jdf .queryExecution ().executedPlan ().toString ()
249
266
250
267
def isLocal (self ):
251
268
"""
@@ -1034,7 +1051,7 @@ def _test():
1034
1051
Row (name = 'Bob' , age = 5 , height = 85 )]).toDF ()
1035
1052
(failure_count , test_count ) = doctest .testmod (
1036
1053
pyspark .sql .dataframe , globs = globs ,
1037
- optionflags = doctest .ELLIPSIS | doctest .NORMALIZE_WHITESPACE )
1054
+ optionflags = doctest .ELLIPSIS | doctest .NORMALIZE_WHITESPACE | doctest . REPORT_NDIFF )
1038
1055
globs ['sc' ].stop ()
1039
1056
if failure_count :
1040
1057
exit (- 1 )
You can’t perform that action at this time.
0 commit comments