@Internal public class HiveGenericUDTF extends TableFunction<Row> implements HiveFunction
GenericUDTF
.Constructor and Description |
---|
HiveGenericUDTF(HiveFunctionWrapper<org.apache.hadoop.hive.ql.udf.generic.GenericUDTF> hiveFunctionWrapper,
HiveShim hiveShim) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Tear-down method for user-defined function.
|
void |
eval(Object... args) |
DataType |
getHiveResultType(Object[] constantArguments,
DataType[] argTypes)
Get result type by arguments and argTypes.
|
TypeInformation |
getResultType()
Returns the result type of the evaluation method.
|
void |
open(FunctionContext context)
Setup method for user-defined function.
|
void |
setArgumentTypesAndConstants(Object[] constantArguments,
DataType[] argTypes)
Set arguments and argTypes for Function instance.
|
protected void |
setCollector(org.apache.hadoop.hive.ql.udf.generic.Collector collector) |
collect, getKind, getParameterTypes, getTypeInference, setCollector
functionIdentifier, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getRequirements, isDeterministic
public HiveGenericUDTF(HiveFunctionWrapper<org.apache.hadoop.hive.ql.udf.generic.GenericUDTF> hiveFunctionWrapper, HiveShim hiveShim)
public void open(FunctionContext context) throws Exception
UserDefinedFunction
open
in class UserDefinedFunction
Exception
@VisibleForTesting protected final void setCollector(org.apache.hadoop.hive.ql.udf.generic.Collector collector)
public void eval(Object... args) throws org.apache.hadoop.hive.ql.metadata.HiveException
org.apache.hadoop.hive.ql.metadata.HiveException
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 DataType getHiveResultType(Object[] constantArguments, DataType[] argTypes)
HiveFunction
We can't use getResultType(Object[], Class[]). The Class[] is the classes of what is defined in eval(), for example, if eval() is "public Integer eval(Double)", the argTypes would be Class[Double]. However, in our wrapper, the signature of eval() is "public Object eval(Object... args)", which means we cannot get any info from the interface.
getHiveResultType
in interface HiveFunction
constantArguments
- arguments of a function call (only literal arguments are passed,
nulls for non-literal ones)argTypes
- types of argumentspublic TypeInformation getResultType()
TableFunction
getResultType
in class TableFunction<Row>
public void close() throws Exception
UserDefinedFunction
close
in class UserDefinedFunction
Exception
Copyright © 2014–2021 The Apache Software Foundation. All rights reserved.