Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
uda-sample.h File Reference
#include <udf/udf.h>
Include dependency graph for uda-sample.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void CountInit (FunctionContext *context, BigIntVal *val)
 This is an example of the COUNT aggregate function. More...
 
void CountUpdate (FunctionContext *context, const IntVal &input, BigIntVal *val)
 
void CountMerge (FunctionContext *context, const BigIntVal &src, BigIntVal *dst)
 
BigIntVal CountFinalize (FunctionContext *context, const BigIntVal &val)
 
void AvgInit (FunctionContext *context, BufferVal *val)
 
void AvgUpdate (FunctionContext *context, const DoubleVal &input, BufferVal *val)
 
void AvgMerge (FunctionContext *context, const BufferVal &src, BufferVal *dst)
 
DoubleVal AvgFinalize (FunctionContext *context, const BufferVal &val)
 
void StringConcatInit (FunctionContext *context, StringVal *val)
 
void StringConcatUpdate (FunctionContext *context, const StringVal &arg1, const StringVal &arg2, StringVal *val)
 
void StringConcatMerge (FunctionContext *context, const StringVal &src, StringVal *dst)
 
StringVal StringConcatFinalize (FunctionContext *context, const StringVal &val)
 

Function Documentation

DoubleVal AvgFinalize ( FunctionContext context,
const BufferVal val 
)

Definition at line 69 of file uda-sample.cc.

References AvgStruct::count, impala_udf::DoubleVal::null(), and AvgStruct::sum.

Referenced by TestAvg().

void AvgInit ( FunctionContext context,
BufferVal val 
)

This is an example of the AVG(double) aggregate function. This function needs to maintain two pieces of state, the current sum and the count. We do this using the BufferVal intermediate type. When this UDA is registered, it would specify 16 bytes (8 byte sum + 8 byte count) as the size for this buffer.

Definition at line 49 of file uda-sample.cc.

Referenced by TestAvg().

void AvgMerge ( FunctionContext context,
const BufferVal src,
BufferVal dst 
)

Definition at line 61 of file uda-sample.cc.

References AvgStruct::count, and AvgStruct::sum.

Referenced by TestAvg().

void AvgUpdate ( FunctionContext context,
const DoubleVal input,
BufferVal val 
)
BigIntVal CountFinalize ( FunctionContext context,
const BigIntVal val 
)

Definition at line 49 of file uda-test.cc.

Referenced by TEST(), and TestCount().

void CountInit ( FunctionContext context,
BigIntVal val 
)

This is an example of the COUNT aggregate function.

Definition at line 34 of file uda-test.cc.

References impala_udf::AnyVal::is_null, and impala_udf::BigIntVal::val.

Referenced by TEST(), and TestCount().

void CountMerge ( FunctionContext context,
const BigIntVal src,
BigIntVal dst 
)

Definition at line 45 of file uda-test.cc.

References impala_udf::BigIntVal::val.

Referenced by TEST(), and TestCount().

void CountUpdate ( FunctionContext context,
const IntVal input,
BigIntVal val 
)

Definition at line 39 of file uda-test.cc.

References impala_udf::AnyVal::is_null, and impala_udf::BigIntVal::val.

Referenced by TEST(), and TestCount().

StringVal StringConcatFinalize ( FunctionContext context,
const StringVal val 
)

Definition at line 104 of file uda-sample.cc.

Referenced by TestStringConcat().

void StringConcatInit ( FunctionContext context,
StringVal val 
)

This is a sample of implementing the STRING_CONCAT aggregate function. Example: select string_concat(string_col, ",") from table

Definition at line 79 of file uda-sample.cc.

References impala_udf::AnyVal::is_null.

Referenced by TestStringConcat().

void StringConcatMerge ( FunctionContext context,
const StringVal src,
StringVal dst 
)

Definition at line 99 of file uda-sample.cc.

References impala_udf::AnyVal::is_null, and StringConcatUpdate().

Referenced by TestStringConcat().

void StringConcatUpdate ( FunctionContext context,
const StringVal arg1,
const StringVal arg2,
StringVal val 
)