@Internal public abstract class HiveScalarFunction<UDFType> extends ScalarFunction implements HiveFunction
UDF
and GenericUDF
functions.Modifier and Type | Field and Description |
---|---|
protected DataType[] |
argTypes |
protected Object[] |
constantArguments |
protected UDFType |
function |
protected HiveFunctionWrapper<UDFType> |
hiveFunctionWrapper |
protected org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector |
returnInspector |
Modifier and Type | Method and Description |
---|---|
Object |
eval(Object... args) |
protected abstract Object |
evalInternal(Object[] args)
Evaluation logical, args will be wrapped when is a single array.
|
TypeInformation |
getResultType(Class[] signature)
Returns the result type of the evaluation method with a given signature.
|
boolean |
isDeterministic()
Returns information about the determinism of the function's results.
|
void |
open(FunctionContext context)
Setup method for user-defined function.
|
protected abstract void |
openInternal()
|
void |
setArgumentTypesAndConstants(Object[] constantArguments,
DataType[] argTypes)
Set arguments and argTypes for Function instance.
|
getKind, getParameterTypes
close, functionIdentifier, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getHiveResultType
getRequirements
protected final HiveFunctionWrapper<UDFType> hiveFunctionWrapper
protected Object[] constantArguments
protected DataType[] argTypes
protected transient UDFType function
protected transient org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector returnInspector
public void setArgumentTypesAndConstants(Object[] constantArguments, DataType[] argTypes)
HiveFunction
setArgumentTypesAndConstants
in interface HiveFunction
constantArguments
- arguments of a function call (only literal arguments
are passed, nulls for non-literal ones)argTypes
- types of argumentspublic boolean isDeterministic()
FunctionDefinition
It returns true
if and only if a call to this function is guaranteed to
always return the same result given the same parameters. true
is
assumed by default. If the function is not pure functional like random(), date(), now(), ...
this method must return false
.
isDeterministic
in interface FunctionDefinition
public TypeInformation getResultType(Class[] signature)
ScalarFunction
This method needs to be overridden in case Flink's type extraction facilities are not
sufficient to extract the TypeInformation
based on the return type of the evaluation
method. Flink's type extraction facilities can handle basic types or
simple POJOs but might be wrong for more complex, custom, or composite types.
getResultType
in class ScalarFunction
signature
- signature of the method the return type needs to be determinedTypeInformation
of result type or null
if Flink should
determine the typepublic void open(FunctionContext context)
UserDefinedFunction
open
in class UserDefinedFunction
protected abstract void openInternal()
Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.