Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support DataFrame.spark.explain(extended: str) case. #1563

Merged
merged 2 commits into from
Jun 4, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions databricks/koalas/spark/accessors.py
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,16 @@ def explain(self, extended: Optional[bool] = None, mode: Optional[str] = None):
== Physical Plan ==
...

>>> df.spark.explain("extended") # doctest: +SKIP
Copy link
Collaborator Author

@ueshin ueshin Jun 3, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not supported in Spark 3.0.0-rc2 yet. I'd skip this for now.

== Parsed Logical Plan ==
...
== Analyzed Logical Plan ==
...
== Optimized Logical Plan ==
...
== Physical Plan ==
...

>>> df.spark.explain(mode="extended") # doctest: +ELLIPSIS
== Parsed Logical Plan ==
...
Expand All @@ -740,10 +750,14 @@ def explain(self, extended: Optional[bool] = None, mode: Optional[str] = None):
...
"""
if LooseVersion(pyspark.__version__) < LooseVersion("3.0"):
if mode is not None and extended is not None:
raise Exception("extended and mode should not be set together.")

if extended is not None and isinstance(extended, str):
mode = extended

if mode is not None:
if extended is not None:
raise Exception("extended and mode can not be specified simultaneously")
elif mode == "simple":
if mode == "simple":
extended = False
elif mode == "extended":
extended = True
Expand Down