Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
uda-test.cc File Reference
#include <iostream>
#include <gtest/gtest.h>
#include "common/logging.h"
#include "udf/uda-test-harness.h"
#include "testutil/test-udas.h"
#include "common/names.h"
Include dependency graph for uda-test.cc:

Go to the source code of this file.

Classes

struct  MinState
 

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 Count2Update (FunctionContext *context, const IntVal &input1, const IntVal &input2, BigIntVal *val)
 
void Count3Update (FunctionContext *context, const IntVal &input1, const IntVal &input2, const IntVal &input3, BigIntVal *val)
 
void Count4Update (FunctionContext *context, const IntVal &input1, const IntVal &input2, const IntVal &input3, const IntVal &input4, BigIntVal *val)
 
void MinInit (FunctionContext *context, BufferVal *val)
 
void MinUpdate (FunctionContext *context, const StringVal &input, BufferVal *val)
 
const BufferVal MinSerialize (FunctionContext *context, const BufferVal &intermediate)
 
void MinMerge (FunctionContext *context, const BufferVal &src, BufferVal *dst)
 
StringVal MinFinalize (FunctionContext *context, const BufferVal &val)
 
void XorInit (FunctionContext *context, BigIntVal *val)
 
void XorUpdate (FunctionContext *context, const double *input, BigIntVal *val)
 
void XorMerge (FunctionContext *context, const BigIntVal &src, BigIntVal *dst)
 
BigIntVal XorFinalize (FunctionContext *context, const BigIntVal &val)
 
void DistinctEstimateInit (FunctionContext *context, StringVal *val)
 
void DistinctEstimatUpdate (FunctionContext *context, const int64_t *input, StringVal *val)
 
StringVal DistinctEstimatSerialize (FunctionContext *context, const StringVal &intermediate)
 
void DistinctEstimateMerge (FunctionContext *context, const StringVal &src, StringVal *dst)
 
BigIntVal DistinctEstimateFinalize (FunctionContext *context, const StringVal &val)
 
 TEST (CountTest, Basic)
 
 TEST (CountMultiArgTest, Basic)
 
bool FuzzyCompare (const BigIntVal &r1, const BigIntVal &r2)
 
 TEST (CountTest, FuzzyEquals)
 
 TEST (MinTest, Basic)
 
 TEST (MemTest, Basic)
 
int main (int argc, char **argv)
 

Function Documentation

void Count2Update ( FunctionContext context,
const IntVal input1,
const IntVal input2,
BigIntVal val 
)

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

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

Referenced by TEST().

void Count3Update ( FunctionContext context,
const IntVal input1,
const IntVal input2,
const IntVal input3,
BigIntVal val 
)

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

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

Referenced by TEST().

void Count4Update ( FunctionContext context,
const IntVal input1,
const IntVal input2,
const IntVal input3,
const IntVal input4,
BigIntVal val 
)

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

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

Referenced by TEST().

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.

Referenced by TEST(), and TestCount().

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

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

Referenced by TEST(), and TestCount().

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

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

Referenced by TEST(), and TestCount().

BigIntVal DistinctEstimateFinalize ( FunctionContext context,
const StringVal val 
)

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

void DistinctEstimateInit ( FunctionContext context,
StringVal val 
)

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

References impala_udf::StringVal::len, and impala_udf::StringVal::ptr.

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

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

References impala_udf::StringVal::ptr.

StringVal DistinctEstimatSerialize ( FunctionContext context,
const StringVal intermediate 
)

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

void DistinctEstimatUpdate ( FunctionContext context,
const int64_t *  input,
StringVal val 
)

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

References impala::hash, and impala_udf::StringVal::ptr.

bool FuzzyCompare ( const BigIntVal r1,
const BigIntVal r2 
)

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

References impala::abs(), impala_udf::AnyVal::is_null, and impala_udf::BigIntVal::val.

Referenced by TEST().

int main ( int  argc,
char **  argv 
)

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

References impala::InitGoogleLoggingSafe().

StringVal MinFinalize ( FunctionContext context,
const BufferVal val 
)
void MinInit ( FunctionContext context,
BufferVal val 
)

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

References MinState::buffer_len, and MinState::value.

Referenced by TEST().

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

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

References MinState::len, MinUpdate(), and MinState::value.

Referenced by TEST().

const BufferVal MinSerialize ( FunctionContext context,
const BufferVal intermediate 
)
void MinUpdate ( FunctionContext context,
const StringVal input,
BufferVal val 
)
BigIntVal XorFinalize ( FunctionContext context,
const BigIntVal val 
)

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

void XorInit ( FunctionContext context,
BigIntVal val 
)

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

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

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

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

References impala_udf::BigIntVal::val.

void XorUpdate ( FunctionContext context,
const double *  input,
BigIntVal val 
)

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

References impala_udf::BigIntVal::val.