Skip to content

Commit

Permalink
[SPARK-8750][SQL] Remove the closure in functions.callUdf.
Browse files Browse the repository at this point in the history
Author: Reynold Xin <rxin@databricks.com>

Closes #7148 from rxin/calludf-closure and squashes the following commits:

00df372 [Reynold Xin] Fixed index out of bound exception.
4beba76 [Reynold Xin] [SPARK-8750][SQL] Remove the closure in functions.callUdf.
  • Loading branch information
rxin committed Jul 1, 2015
1 parent 0eee061 commit 9765241
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion sql/core/src/main/scala/org/apache/spark/sql/functions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1829,7 +1829,15 @@ object functions {
*/
@deprecated("Use callUDF", "1.5.0")
def callUdf(udfName: String, cols: Column*): Column = {
UnresolvedFunction(udfName, cols.map(_.expr))
// Note: we avoid using closures here because on file systems that are case-insensitive, the
// compiled class file for the closure here will conflict with the one in callUDF (upper case).
val exprs = new Array[Expression](cols.size)
var i = 0
while (i < cols.size) {
exprs(i) = cols(i).expr
i += 1
}
UnresolvedFunction(udfName, exprs)
}

}

0 comments on commit 9765241

Please sign in to comment.