Skip to content

Commit 9765241

Browse files
committed
[SPARK-8750][SQL] Remove the closure in functions.callUdf.
Author: Reynold Xin <[email protected]> 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.
1 parent 0eee061 commit 9765241

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

sql/core/src/main/scala/org/apache/spark/sql/functions.scala

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1829,7 +1829,15 @@ object functions {
18291829
*/
18301830
@deprecated("Use callUDF", "1.5.0")
18311831
def callUdf(udfName: String, cols: Column*): Column = {
1832-
UnresolvedFunction(udfName, cols.map(_.expr))
1832+
// Note: we avoid using closures here because on file systems that are case-insensitive, the
1833+
// compiled class file for the closure here will conflict with the one in callUDF (upper case).
1834+
val exprs = new Array[Expression](cols.size)
1835+
var i = 0
1836+
while (i < cols.size) {
1837+
exprs(i) = cols(i).expr
1838+
i += 1
1839+
}
1840+
UnresolvedFunction(udfName, exprs)
18331841
}
18341842

18351843
}

0 commit comments

Comments
 (0)