Skip to content
Closed
Show file tree
Hide file tree
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
11 changes: 6 additions & 5 deletions python/pyspark/sql/dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,11 +305,12 @@ def explain(self, extended=None, mode=None):
is_mode_case = mode is not None and isinstance(mode, basestring)

if not is_no_argument and not (is_extended_case or is_mode_case):
argtypes = [
str(type(arg)) for arg in [extended, mode] if arg is not None]
raise TypeError(
"extended (optional) and mode (optional) should be a bool and str; "
"however, got [%s]." % ", ".join(argtypes))
if extended is not None:
errMsg = "extended (optional) should be provided as bool" \
", got {0}".format(type(extended))
else: # For mode case
errMsg = "mode (optional) should be provided as str, got {0}".format(type(mode))
raise TypeError(errMsg)
Comment thread
dongjoon-hyun marked this conversation as resolved.

# Sets an explain mode depending on a given argument
if is_no_argument:
Expand Down
1 change: 1 addition & 0 deletions sql/core/src/main/scala/org/apache/spark/sql/Dataset.scala
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,7 @@ class Dataset[T] private[sql](
}
}

// This method intends to be called from PySpark DataFrame
Comment thread
dongjoon-hyun marked this conversation as resolved.
private[sql] def toExplainString(mode: String): String = {
mode.toLowerCase(Locale.ROOT) match {
case "simple" => toExplainString(ExplainMode.Simple)
Expand Down