HostUDFWrapper#

public abstract class HostUDFWrapper#

A wrapper around native host UDF aggregations.

This class is used to create the native handle of a host UDF aggregation and is used as a proxy object to compute hash code and compare two host UDF aggregations for equality.

A new host UDF aggregation implementation must extend this class and override the computeHashCode and isEqual methods for such purposes.

Method Summary

closeUDFInstance(long hostUDFInstance)

Close the derived UDF instance created by createUDFInstance.

computeHashCode()

createUDFInstance()

Create a derived host UDF native instance.

equals(Object obj)

hashCode()

isEqual(Object obj)

Methods

public abstract long createUDFInstance()#

Create a derived host UDF native instance.

The instance created by this function MUST be closed by closeUDFInstance

Typical usage, refer to Aggregation.java:

long udf = 0;
try {
    udf = wrapper.createUDFInstance();
    return Aggregation.createHostUDFAgg(udf);
} finally {
    // a new UDF is cloned in `createHostUDFAgg`, here should close the UDF instance.
    if (udf != 0) {
        HostUDFWrapper.closeUDFInstance(udf);
    }
}
public abstract int computeHashCode()#
public int hashCode()#
public abstract boolean isEqual(Object obj)#
public boolean equals(Object obj)#

Static Methods

public static void closeUDFInstance(long hostUDFInstance)#

Close the derived UDF instance created by createUDFInstance.

Parameters:

hostUDFInstance – the UDF instance