Skip to content

Commit

Permalink
renamed a few variables in functions to use UDF
Browse files Browse the repository at this point in the history
  • Loading branch information
BenFradet committed Jun 29, 2015
1 parent 8ab0f2d commit c500f29
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ class SQLContext(@transient val sparkContext: SparkContext)
*
* The following example registers a Scala closure as UDF:
* {{{
* sqlContext.udf.register("myUdf", (arg1: Int, arg2: String) => arg2 + arg1)
* sqlContext.udf.register("myUDF", (arg1: Int, arg2: String) => arg2 + arg1)
* }}}
*
* The following example registers a UDF in Java:
Expand Down
12 changes: 6 additions & 6 deletions sql/core/src/main/scala/org/apache/spark/sql/functions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1477,7 +1477,7 @@ object functions {
(0 to 10).map { x =>
val args = (1 to x).map(i => s"arg$i: Column").mkString(", ")
val fTypes = Seq.fill(x + 1)("_").mkString(", ")
val argsInUdf = (1 to x).map(i => s"arg$i.expr").mkString(", ")
val argsInUDF = (1 to x).map(i => s"arg$i.expr").mkString(", ")
println(s"""
/**
* Call a Scala function of ${x} arguments as user-defined function (UDF). This requires
Expand All @@ -1489,7 +1489,7 @@ object functions {
*/
@deprecated("Use udf", "1.5.0")
def callUDF(f: Function$x[$fTypes], returnType: DataType${if (args.length > 0) ", " + args else ""}): Column = {
ScalaUdf(f, returnType, Seq($argsInUdf))
ScalaUDF(f, returnType, Seq($argsInUDF))
}""")
}
}
Expand Down Expand Up @@ -1770,8 +1770,8 @@ object functions {
*
* val df = Seq(("id1", 1), ("id2", 4), ("id3", 5)).toDF("id", "value")
* val sqlContext = df.sqlContext
* sqlContext.udf.register("simpleUdf", (v: Int) => v * v)
* df.select($"id", callUDF("simpleUdf", $"value"))
* sqlContext.udf.register("simpleUDF", (v: Int) => v * v)
* df.select($"id", callUDF("simpleUDF", $"value"))
* }}}
*
* @group udf_funcs
Expand All @@ -1789,8 +1789,8 @@ object functions {
*
* val df = Seq(("id1", 1), ("id2", 4), ("id3", 5)).toDF("id", "value")
* val sqlContext = df.sqlContext
* sqlContext.udf.register("simpleUdf", (v: Int) => v * v)
* df.select($"id", callUdf("simpleUdf", $"value"))
* sqlContext.udf.register("simpleUDF", (v: Int) => v * v)
* df.select($"id", callUdf("simpleUDF", $"value"))
* }}}
*
* @group udf_funcs
Expand Down

0 comments on commit c500f29

Please sign in to comment.