org.apache.hadoop.hive.ql.udf.generic
Class GenericUDFIn
java.lang.Object
org.apache.hadoop.hive.ql.udf.generic.GenericUDF
org.apache.hadoop.hive.ql.udf.generic.GenericUDFIn
- All Implemented Interfaces:
- Closeable
public class GenericUDFIn
- extends GenericUDF
GenericUDFIn
Example usage:
SELECT key FROM src WHERE key IN ("238", "1");
From MySQL page on IN(): To comply with the SQL standard, IN returns NULL
not only if the expression on the left hand side is NULL, but also if no
match is found in the list and one of the expressions in the list is NULL.
Also noteworthy: type conversion behavior is different from MySQL. With
expr IN expr1, expr2... in MySQL, exprN will each be converted into the same
type as expr. In the Hive implementation, all expr(N) will be converted into
a common type for conversion consistency with other UDF's, and to prevent
conversions from a big type to a small type (e.g. int to tinyint)
GenericUDFIn
public GenericUDFIn()
initialize
public ObjectInspector initialize(ObjectInspector[] arguments)
throws UDFArgumentException
- Description copied from class:
GenericUDF
- Initialize this GenericUDF. This will be called once and only once per
GenericUDF instance.
- Specified by:
initialize
in class GenericUDF
- Parameters:
arguments
- The ObjectInspector for the arguments
- Returns:
- The ObjectInspector for the return value
- Throws:
UDFArgumentException
- Thrown when arguments have wrong types, wrong length, etc.
evaluate
public Object evaluate(GenericUDF.DeferredObject[] arguments)
throws HiveException
- Description copied from class:
GenericUDF
- Evaluate the GenericUDF with the arguments.
- Specified by:
evaluate
in class GenericUDF
- Parameters:
arguments
- The arguments as DeferedObject, use DeferedObject.get() to get the
actual argument Object. The Objects can be inspected by the
ObjectInspectors passed in the initialize call.
- Returns:
- The
- Throws:
HiveException
getDisplayString
public String getDisplayString(String[] children)
- Description copied from class:
GenericUDF
- Get the String to be displayed in explain.
- Specified by:
getDisplayString
in class GenericUDF
Copyright © 2014 The Apache Software Foundation. All rights reserved.