You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by rx...@apache.org on 2016/03/21 23:24:21 UTC
spark git commit: [SPARK-14004][FOLLOW-UP] Implementations of
NonSQLExpression should not override sql method
Repository: spark
Updated Branches:
refs/heads/master f35df7d18 -> f3717fc7c
[SPARK-14004][FOLLOW-UP] Implementations of NonSQLExpression should not override sql method
## What changes were proposed in this pull request?
There is only one exception: `PythonUDF`. However, I don't think the `PythonUDF#` prefix is useful, as we can only create python udf under python context. This PR removes the `PythonUDF#` prefix from `PythonUDF.toString`, so that it doesn't need to overrde `sql`.
## How was this patch tested?
existing tests.
Author: Wenchen Fan <we...@databricks.com>
Closes #11859 from cloud-fan/tmp.
Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/f3717fc7
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/f3717fc7
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/f3717fc7
Branch: refs/heads/master
Commit: f3717fc7c97ea402c9ddf9020405070421eeb4a4
Parents: f35df7d
Author: Wenchen Fan <we...@databricks.com>
Authored: Mon Mar 21 15:24:18 2016 -0700
Committer: Reynold Xin <rx...@databricks.com>
Committed: Mon Mar 21 15:24:18 2016 -0700
----------------------------------------------------------------------
.../org/apache/spark/sql/catalyst/expressions/Expression.scala | 2 +-
.../scala/org/apache/spark/sql/execution/python/PythonUDF.scala | 4 +---
2 files changed, 2 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/spark/blob/f3717fc7/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 16a1b2a..5f8899d 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
@@ -226,7 +226,7 @@ trait Unevaluable extends Expression {
* `ScalaUDF`, `ScalaUDAF`, and object expressions like `MapObjects` and `Invoke`.
*/
trait NonSQLExpression extends Expression {
- override def sql: String = {
+ final override def sql: String = {
transform {
case a: Attribute => new PrettyAttribute(a)
}.toString
http://git-wip-us.apache.org/repos/asf/spark/blob/f3717fc7/sql/core/src/main/scala/org/apache/spark/sql/execution/python/PythonUDF.scala
----------------------------------------------------------------------
diff --git a/sql/core/src/main/scala/org/apache/spark/sql/execution/python/PythonUDF.scala b/sql/core/src/main/scala/org/apache/spark/sql/execution/python/PythonUDF.scala
index 9c31456..4f1b837 100644
--- a/sql/core/src/main/scala/org/apache/spark/sql/execution/python/PythonUDF.scala
+++ b/sql/core/src/main/scala/org/apache/spark/sql/execution/python/PythonUDF.scala
@@ -32,9 +32,7 @@ case class PythonUDF(
children: Seq[Expression])
extends Expression with Unevaluable with NonSQLExpression with Logging {
- override def toString: String = s"PythonUDF#$name(${children.mkString(", ")})"
+ override def toString: String = s"$name(${children.mkString(", ")})"
override def nullable: Boolean = true
-
- override def sql: String = s"$name(${children.mkString(", ")})"
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org