@Deprecated public class UDF extends Object
New UDF classes need to inherit from this UDF class (or from org.apache.hadoop.hive.ql.udf.generic.GenericUDF GenericUDF which provides more flexibility at the cost of more complexity).
Requirements for all classes extending this UDF are:
evaluate
which will be called by Hive (the exact
way in which Hive resolves the method to call can be configured by setting a custom UDFMethodResolver
). The following are some examples:
public int evaluate();
public int evaluate(int a);
public double evaluate(int a, double b);
public String evaluate(String a, int b, Text c);
public Text evaluate(String a);
public String evaluate(List<Integer> a);
(Note that Hive Arrays are represented as
Lists
in Hive.
So an ARRAY<int>
column would be passed in as a List<Integer>
.)evaluate
should never be a void method. However it can return null
if
needed.
Writable
class.Description
,
UDFType
Modifier | Constructor and Description |
---|---|
|
UDF()
Deprecated.
The constructor.
|
protected |
UDF(UDFMethodResolver rslv)
Deprecated.
The constructor with user-provided
UDFMethodResolver . |
Modifier and Type | Method and Description |
---|---|
String[] |
getRequiredFiles()
Deprecated.
This can be overridden to include files required by this UDF.
|
String[] |
getRequiredJars()
Deprecated.
This can be overridden to include JARs required by this UDF.
|
UDFMethodResolver |
getResolver()
Deprecated.
Get the method resolver.
|
void |
setResolver(UDFMethodResolver rslv)
Deprecated.
Sets the resolver.
|
public UDF()
protected UDF(UDFMethodResolver rslv)
UDFMethodResolver
.public void setResolver(UDFMethodResolver rslv)
rslv
- The method resolver to use for method resolution.public UDFMethodResolver getResolver()
public String[] getRequiredJars()
null
by default.public String[] getRequiredFiles()
null
by default.Copyright © 2023 The Apache Software Foundation. All rights reserved.