You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by ma...@apache.org on 2015/10/08 19:22:11 UTC
spark git commit: [SPARK-10998] [SQL] Show non-children in default
Expression.toString
Repository: spark
Updated Branches:
refs/heads/master e8f90d9dd -> 5c9fdf74e
[SPARK-10998] [SQL] Show non-children in default Expression.toString
Its pretty hard to debug problems with expressions when you can't see all the arguments.
Before: `invoke()`
After: `invoke(inputObject#1, intField, IntegerType)`
Author: Michael Armbrust <mi...@databricks.com>
Closes #9022 from marmbrus/expressionToString.
Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/5c9fdf74
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/5c9fdf74
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/5c9fdf74
Branch: refs/heads/master
Commit: 5c9fdf74e328c067388ba1109eb48bf9d128bcf4
Parents: e8f90d9
Author: Michael Armbrust <mi...@databricks.com>
Authored: Thu Oct 8 10:22:06 2015 -0700
Committer: Michael Armbrust <mi...@databricks.com>
Committed: Thu Oct 8 10:22:06 2015 -0700
----------------------------------------------------------------------
.../apache/spark/sql/catalyst/expressions/Expression.scala | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/spark/blob/5c9fdf74/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Expression.scala
----------------------------------------------------------------------
diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Expression.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Expression.scala
index 96284b9..96fcc79 100644
--- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Expression.scala
+++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Expression.scala
@@ -174,7 +174,13 @@ abstract class Expression extends TreeNode[Expression] {
}.toString
}
- override def toString: String = prettyName + children.mkString("(", ",", ")")
+
+ private def flatArguments = productIterator.flatMap {
+ case t: Traversable[_] => t
+ case single => single :: Nil
+ }
+
+ override def toString: String = prettyName + flatArguments.mkString("(", ",", ")")
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org