@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, getTypeInference
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
getResultType
in class ScalarFunction
public void open(FunctionContext context)
UserDefinedFunction
open
in class UserDefinedFunction
protected abstract void openInternal()
Copyright © 2014–2021 The Apache Software Foundation. All rights reserved.