Skip to content

Commit

Permalink
Updated example.
Browse files Browse the repository at this point in the history
  • Loading branch information
rxin committed Jan 15, 2015
1 parent 675a3c9 commit ae9c556
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions sql/core/src/main/scala/org/apache/spark/sql/SQLContext.scala
Original file line number Diff line number Diff line change
Expand Up @@ -347,19 +347,20 @@ class SQLContext(@transient val sparkContext: SparkContext)
*
* The following example registers a UDF in Java:
* {{{
* sqlContext.udf().register("myUDF", DataTypes.StringType,
* sqlContext.udf().register("myUDF",
* new UDF2<Integer, String, String>() {
* @Override
* public String call(Integer arg1, String arg2) {
* return arg2 + arg1;
* }
* });
* }, DataTypes.StringType);
* }}}
*
* Or, to use Java 8 lambda syntax:
* {{{
* sqlContext.udf().register("myUDF", DataTypes.StringType,
* (Integer arg1, String arg2) -> arg2 + arg1));
* sqlContext.udf().register("myUDF",
* (Integer arg1, String arg2) -> arg2 + arg1),
* DataTypes.StringType);
* }}}
*/
val udf: UDFRegistration = new UDFRegistration(this)
Expand Down

0 comments on commit ae9c556

Please sign in to comment.