cloud-fan commented on a change in pull request #27509: [SPARK-30764][SQL]
Improve the readability of EXPLAIN FORMATTED style
URL: https://github.com/apache/spark/pull/27509#discussion_r381961389
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/ExplainUtils.scala
##########
@@ -182,6 +181,17 @@ object ExplainUtils {
}
}
+ /**
+ * Generate detailed field string with different format based on type of
input value
+ */
+ def generateFieldString(fieldName: String, values: Any): String = values
match {
+ case iter: Iterable[_] if (iter.size == 0) => s"${fieldName}: []"
+ case iter: Iterable[_] => s"${fieldName} [${iter.size}]:
${iter.mkString("[", ", ", "]")}"
+ case str: String if (str == null || str.isEmpty) => s"${fieldName}: None"
+ case str: String => s"${fieldName}: ${str}"
+ case _ => s"${fieldName}: Unknown"
Review comment:
This is not expected. Shall we just throw exception here?
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]