@Internal public class HiveGenericUDTF extends TableFunction<Row> implements HiveFunction
GenericUDTF
.collector
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 with a given signature.
|
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, 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
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 TableFunction<Row>
TypeInformation
of result type or null
if Flink should determine the typepublic void close() throws Exception
UserDefinedFunction
close
in class UserDefinedFunction
Exception
Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.