Class: UDFRegistration

eclairjs/sql. UDFRegistration

Registering user-defined functions.

Constructor

new UDFRegistration()

Since:
  • EclairJS 0.5 Spark 1.3.0
Source:
Example
sqlContext.udf().register("udfTest", function(col1, ...col22) {
      return col1 + ...col22;
}, DataTypes.StringType);
var smt = "SELECT *, udfTest(mytable.col1,...mytable.col22) as transformedByUDF FROM mytable";
var result = sqlContext.sql(smt).collect();

Methods

register(name, func, returnType, bindArgsopt)

Register a Scala closure of 0 arguments as user-defined function (UDF).
Parameters:
Name Type Attributes Description
name string
func func function with 1 to 22 arguments
returnType module:eclairjs/sql/types.DataType DataType returned from the UDF function
bindArgs Array.<object> <optional>
Since:
  • EclairJS 0.5 Spark 1.3.0
Source: