Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
com.cloudera.impala.hive.executor.UdfExecutor Class Reference
Collaboration diagram for com.cloudera.impala.hive.executor.UdfExecutor:

Public Member Functions

 UdfExecutor (byte[] thriftParams) throws ImpalaException
 
 UdfExecutor (String jarFile, String udfPath, Type retType, Type...parameterTypes) throws ImpalaRuntimeException
 
void close ()
 
void evaluate () throws ImpalaRuntimeException
 
long evaluate (Object...args) throws ImpalaRuntimeException
 
Method getMethod ()
 

Protected Member Functions

void finalize () throws Throwable
 

Package Attributes

ArrayList< Long > allocations_ = Lists.newArrayList()
 

Private Member Functions

PrimitiveType getPrimitiveType (Class<?> c)
 
void storeUdfResult (Object obj) throws ImpalaRuntimeException
 
void allocateInputObjects () throws ImpalaRuntimeException
 
ClassLoader getClassLoader (String jarPath) throws MalformedURLException
 
void init (String jarPath, String udfPath, Type retType, Type...parameterTypes) throws ImpalaRuntimeException
 

Private Attributes

UDF udf_
 
Method method_
 
Type[] argTypes_
 
Type retType_
 
final long inputBufferPtr_
 
final long inputNullsPtr_
 
final int[] inputBufferOffsets_
 
final long outputBufferPtr_
 
final long outputNullPtr_
 
long outBufferStringPtr_
 
int outBufferCapacity_
 
Object[] inputObjects_
 
Object[] inputArgs_
 
boolean[] isArgString_
 

Static Private Attributes

static final Logger LOG = Logger.getLogger(UdfExecutor.class)
 
static final String UDF_FUNCTION_NAME = "evaluate"
 
static final
TBinaryProtocol.Factory 
protocolFactory
 

Detailed Description

Definition at line 57 of file UdfExecutor.java.

Constructor & Destructor Documentation

com.cloudera.impala.hive.executor.UdfExecutor.UdfExecutor ( byte[]  thriftParams) throws ImpalaException
inline

Create a UdfExecutor, using parameters from a serialized thrift object. Used by the backend.

Definition at line 110 of file UdfExecutor.java.

com.cloudera.impala.hive.executor.UdfExecutor.UdfExecutor ( String  jarFile,
String  udfPath,
Type  retType,
Type...  parameterTypes 
) throws ImpalaRuntimeException
inline

Creates a UdfExecutor object, loading the class and validating it has the proper function. This constructor is only used for testing.

Parameters
jarFilePath to jar containing the UDF. null indicates to use the current jar file.
udfPathfully qualified class path for the UDF

Definition at line 143 of file UdfExecutor.java.

Member Function Documentation

void com.cloudera.impala.hive.executor.UdfExecutor.allocateInputObjects ( ) throws ImpalaRuntimeException
inlineprivate

Definition at line 344 of file UdfExecutor.java.

References offset.

void com.cloudera.impala.hive.executor.UdfExecutor.close ( )
inline

Releases any resources allocated off the native heap.

Definition at line 179 of file UdfExecutor.java.

void com.cloudera.impala.hive.executor.UdfExecutor.evaluate ( ) throws ImpalaRuntimeException
inline

evaluate function called by the backend. The inputs to the UDF have been serialized to 'input'

Definition at line 194 of file UdfExecutor.java.

References com.cloudera.impala.util.UnsafeUtil.UNSAFE.

long com.cloudera.impala.hive.executor.UdfExecutor.evaluate ( Object...  args) throws ImpalaRuntimeException
inline

Evalutes the UDF with 'args' as the input to the UDF. This is exposed for testing and not the version of evaluate() the backend uses. Returns 0 if the udf returned NULL. (the result is a ptr so this is okay).

Definition at line 221 of file UdfExecutor.java.

References com.cloudera.impala.util.UnsafeUtil.UNSAFE.

void com.cloudera.impala.hive.executor.UdfExecutor.finalize ( ) throws Throwable
inlineprotected

Definition at line 171 of file UdfExecutor.java.

ClassLoader com.cloudera.impala.hive.executor.UdfExecutor.getClassLoader ( String  jarPath) throws MalformedURLException
inlineprivate

Definition at line 397 of file UdfExecutor.java.

Method com.cloudera.impala.hive.executor.UdfExecutor.getMethod ( )
inline

Definition at line 235 of file UdfExecutor.java.

void com.cloudera.impala.hive.executor.UdfExecutor.init ( String  jarPath,
String  udfPath,
Type  retType,
Type...  parameterTypes 
) throws ImpalaRuntimeException
inlineprivate

Initializes the UdfExecutor validating the UDF has the proper signature. This uses reflection to look up the "evaluate" function in the UDF class.

Definition at line 410 of file UdfExecutor.java.

void com.cloudera.impala.hive.executor.UdfExecutor.storeUdfResult ( Object  obj) throws ImpalaRuntimeException
inlineprivate

Member Data Documentation

ArrayList<Long> com.cloudera.impala.hive.executor.UdfExecutor.allocations_ = Lists.newArrayList()
package

Definition at line 104 of file UdfExecutor.java.

Type [] com.cloudera.impala.hive.executor.UdfExecutor.argTypes_
private

Definition at line 68 of file UdfExecutor.java.

Object [] com.cloudera.impala.hive.executor.UdfExecutor.inputArgs_
private

Definition at line 96 of file UdfExecutor.java.

final int [] com.cloudera.impala.hive.executor.UdfExecutor.inputBufferOffsets_
private

Definition at line 78 of file UdfExecutor.java.

final long com.cloudera.impala.hive.executor.UdfExecutor.inputBufferPtr_
private

Definition at line 73 of file UdfExecutor.java.

final long com.cloudera.impala.hive.executor.UdfExecutor.inputNullsPtr_
private

Definition at line 74 of file UdfExecutor.java.

Object [] com.cloudera.impala.hive.executor.UdfExecutor.inputObjects_
private

Definition at line 95 of file UdfExecutor.java.

boolean [] com.cloudera.impala.hive.executor.UdfExecutor.isArgString_
private

Definition at line 100 of file UdfExecutor.java.

final Logger com.cloudera.impala.hive.executor.UdfExecutor.LOG = Logger.getLogger(UdfExecutor.class)
staticprivate

Definition at line 58 of file UdfExecutor.java.

Method com.cloudera.impala.hive.executor.UdfExecutor.method_
private

Definition at line 67 of file UdfExecutor.java.

int com.cloudera.impala.hive.executor.UdfExecutor.outBufferCapacity_
private

Definition at line 91 of file UdfExecutor.java.

long com.cloudera.impala.hive.executor.UdfExecutor.outBufferStringPtr_
private

Definition at line 88 of file UdfExecutor.java.

final long com.cloudera.impala.hive.executor.UdfExecutor.outputBufferPtr_
private

Definition at line 81 of file UdfExecutor.java.

final long com.cloudera.impala.hive.executor.UdfExecutor.outputNullPtr_
private

Definition at line 82 of file UdfExecutor.java.

final TBinaryProtocol.Factory com.cloudera.impala.hive.executor.UdfExecutor.protocolFactory
staticprivate
Initial value:
=
new TBinaryProtocol.Factory()

Definition at line 63 of file UdfExecutor.java.

Type com.cloudera.impala.hive.executor.UdfExecutor.retType_
private

Definition at line 69 of file UdfExecutor.java.

UDF com.cloudera.impala.hive.executor.UdfExecutor.udf_
private

Definition at line 66 of file UdfExecutor.java.

final String com.cloudera.impala.hive.executor.UdfExecutor.UDF_FUNCTION_NAME = "evaluate"
staticprivate

Definition at line 60 of file UdfExecutor.java.


The documentation for this class was generated from the following file: