Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
impala::AggregateFunctions Class Reference

#include <aggregate-functions.h>

Collaboration diagram for impala::AggregateFunctions:

Public Member Functions

template<>
void InitZero (FunctionContext *, DecimalVal *dst)
 
template<>
void Min (FunctionContext *ctx, const StringVal &src, StringVal *dst)
 
template<>
void Max (FunctionContext *ctx, const StringVal &src, StringVal *dst)
 
template<>
void Min (FunctionContext *ctx, const DecimalVal &src, DecimalVal *dst)
 
template<>
void Max (FunctionContext *ctx, const DecimalVal &src, DecimalVal *dst)
 
template<>
void Min (FunctionContext *, const TimestampVal &src, TimestampVal *dst)
 
template<>
void Max (FunctionContext *, const TimestampVal &src, TimestampVal *dst)
 
template<>
void LastValUpdate (FunctionContext *ctx, const StringVal &src, StringVal *dst)
 
template<>
void LastValRemove (FunctionContext *ctx, const StringVal &src, StringVal *dst)
 
template<>
void FirstValUpdate (FunctionContext *ctx, const StringVal &src, StringVal *dst)
 

Static Public Member Functions

static void InitNull (FunctionContext *, AnyVal *dst)
 Initializes dst to NULL. More...
 
static void InitNullString (FunctionContext *c, StringVal *dst)
 Initializes dst to NULL and sets dst->ptr to NULL. More...
 
template<typename T >
static void InitZero (FunctionContext *, T *dst)
 Initializes dst to 0. More...
 
static StringVal StringValGetValue (FunctionContext *ctx, const StringVal &src)
 StringVal GetValue() function that returns a copy of src. More...
 
static StringVal StringValSerializeOrFinalize (FunctionContext *ctx, const StringVal &src)
 StringVal Serialize/Finalize function that copies and frees src. More...
 
static void CountUpdate (FunctionContext *, const AnyVal &src, BigIntVal *dst)
 Implementation of Count and Count(*) More...
 
static void CountStarUpdate (FunctionContext *, BigIntVal *dst)
 
static void CountRemove (FunctionContext *, const AnyVal &src, BigIntVal *dst)
 
static void CountStarRemove (FunctionContext *, BigIntVal *dst)
 
static void CountMerge (FunctionContext *, const BigIntVal &src, BigIntVal *dst)
 
static void AvgInit (FunctionContext *ctx, StringVal *dst)
 
template<typename T >
static void AvgUpdate (FunctionContext *ctx, const T &src, StringVal *dst)
 
template<typename T >
static void AvgRemove (FunctionContext *ctx, const T &src, StringVal *dst)
 
static void AvgMerge (FunctionContext *ctx, const StringVal &src, StringVal *dst)
 
static DoubleVal AvgGetValue (FunctionContext *ctx, const StringVal &val)
 
static DoubleVal AvgFinalize (FunctionContext *ctx, const StringVal &val)
 
static void TimestampAvgUpdate (FunctionContext *ctx, const TimestampVal &src, StringVal *dst)
 Avg for timestamp. Uses AvgInit() and AvgMerge(). More...
 
static void TimestampAvgRemove (FunctionContext *ctx, const TimestampVal &src, StringVal *dst)
 
static TimestampVal TimestampAvgGetValue (FunctionContext *ctx, const StringVal &val)
 
static TimestampVal TimestampAvgFinalize (FunctionContext *ctx, const StringVal &val)
 
static void DecimalAvgInit (FunctionContext *ctx, StringVal *dst)
 Avg for decimals. More...
 
static void DecimalAvgUpdate (FunctionContext *ctx, const DecimalVal &src, StringVal *dst)
 
static void DecimalAvgRemove (FunctionContext *ctx, const DecimalVal &src, StringVal *dst)
 
static void DecimalAvgAddOrRemove (FunctionContext *ctx, const DecimalVal &src, StringVal *dst, bool remove=false)
 
static void DecimalAvgMerge (FunctionContext *ctx, const StringVal &src, StringVal *dst)
 
static DecimalVal DecimalAvgGetValue (FunctionContext *ctx, const StringVal &val)
 
static DecimalVal DecimalAvgFinalize (FunctionContext *ctx, const StringVal &val)
 
template<typename SRC_VAL , typename DST_VAL >
static void SumUpdate (FunctionContext *, const SRC_VAL &src, DST_VAL *dst)
 SumUpdate, SumMerge. More...
 
template<typename SRC_VAL , typename DST_VAL >
static void SumRemove (FunctionContext *, const SRC_VAL &src, DST_VAL *dst)
 
static void SumDecimalUpdate (FunctionContext *, const DecimalVal &src, DecimalVal *dst)
 Sum for decimals. More...
 
static void SumDecimalRemove (FunctionContext *, const DecimalVal &src, DecimalVal *dst)
 
static void SumDecimalMerge (FunctionContext *, const DecimalVal &src, DecimalVal *dst)
 
static void SumDecimalAddOrSubtract (FunctionContext *, const DecimalVal &src, DecimalVal *dst, bool subtract=false)
 Adds or or subtracts src from dst. Implements Update() and Remove(). More...
 
template<typename T >
static void Min (FunctionContext *, const T &src, T *dst)
 MinUpdate/MinMerge. More...
 
template<typename T >
static void Max (FunctionContext *, const T &src, T *dst)
 MaxUpdate/MaxMerge. More...
 
static void StringConcatUpdate (FunctionContext *, const StringVal &src, StringVal *result)
 String concat. More...
 
static void StringConcatUpdate (FunctionContext *, const StringVal &src, const StringVal &separator, StringVal *result)
 
static void StringConcatMerge (FunctionContext *, const StringVal &src, StringVal *result)
 
static StringVal StringConcatFinalize (FunctionContext *, const StringVal &src)
 
static void PcInit (FunctionContext *, StringVal *slot)
 
template<typename T >
static void PcUpdate (FunctionContext *, const T &src, StringVal *dst)
 
template<typename T >
static void PcsaUpdate (FunctionContext *, const T &src, StringVal *dst)
 
static void PcMerge (FunctionContext *, const StringVal &src, StringVal *dst)
 
static BigIntVal PcFinalize (FunctionContext *, const StringVal &src)
 
static BigIntVal PcsaFinalize (FunctionContext *, const StringVal &src)
 
template<typename T >
static void ReservoirSampleInit (FunctionContext *, StringVal *slot)
 
template<typename T >
static void ReservoirSampleUpdate (FunctionContext *, const T &src, StringVal *dst)
 
template<typename T >
static void ReservoirSampleMerge (FunctionContext *, const StringVal &src, StringVal *dst)
 
template<typename T >
static const StringVal ReservoirSampleSerialize (FunctionContext *, const StringVal &src)
 
template<typename T >
static StringVal ReservoirSampleFinalize (FunctionContext *, const StringVal &src)
 Returns 20,000 unsorted samples as a list of comma-separated values. More...
 
template<typename T >
static T AppxMedianFinalize (FunctionContext *, const StringVal &src)
 Returns an approximate median using reservoir sampling. More...
 
template<typename T >
static StringVal HistogramFinalize (FunctionContext *, const StringVal &src)
 
static void HllInit (FunctionContext *, StringVal *slot)
 
template<typename T >
static void HllUpdate (FunctionContext *, const T &src, StringVal *dst)
 
static void HllMerge (FunctionContext *, const StringVal &src, StringVal *dst)
 
static BigIntVal HllFinalize (FunctionContext *, const StringVal &src)
 
static uint64_t HllFinalEstimate (const uint8_t *buckets, int32_t num_buckets)
 
static void KnuthVarInit (FunctionContext *context, StringVal *val)
 
template<typename T >
static void KnuthVarUpdate (FunctionContext *context, const T &input, StringVal *val)
 
static void KnuthVarMerge (FunctionContext *context, const StringVal &src, StringVal *dst)
 
static DoubleVal KnuthVarFinalize (FunctionContext *context, const StringVal &val)
 
static DoubleVal KnuthVarPopFinalize (FunctionContext *context, const StringVal &val)
 Calculates the biased variance, uses KnuthVar Init-Update-Merge functions. More...
 
static DoubleVal KnuthStddevFinalize (FunctionContext *context, const StringVal &val)
 Calculates STDDEV, uses KnuthVar Init-Update-Merge functions. More...
 
static DoubleVal KnuthStddevPopFinalize (FunctionContext *context, const StringVal &val)
 Calculates the biased STDDEV, uses KnuthVar Init-Update-Merge functions. More...
 
static void RankInit (FunctionContext *, StringVal *slot)
 Initializes the state for RANK and DENSE_RANK. More...
 
static void RankUpdate (FunctionContext *, StringVal *dst)
 Update state for RANK. More...
 
static void DenseRankUpdate (FunctionContext *, StringVal *dst)
 Update state for DENSE_RANK. More...
 
static BigIntVal RankGetValue (FunctionContext *, StringVal &src)
 Returns the result for RANK and prepares the state for the next Update(). More...
 
static BigIntVal DenseRankGetValue (FunctionContext *, StringVal &src)
 
static BigIntVal RankFinalize (FunctionContext *, StringVal &src)
 Returns the result for RANK and DENSE_RANK and cleans up intermediate state in src. More...
 
template<typename T >
static void LastValUpdate (FunctionContext *, const T &src, T *dst)
 Implements LAST_VALUE. More...
 
template<typename T >
static void LastValRemove (FunctionContext *, const T &src, T *dst)
 
template<typename T >
static void FirstValUpdate (FunctionContext *, const T &src, T *dst)
 Implements FIRST_VALUE. More...
 
template<typename T >
static void FirstValRewriteUpdate (FunctionContext *, const T &src, const BigIntVal &, T *dst)
 
template<typename T >
static void OffsetFnInit (FunctionContext *, T *dst)
 
template<typename T >
static void OffsetFnUpdate (FunctionContext *, const T &src, const BigIntVal &, const T &, T *dst)
 

Static Public Attributes

static const int HLL_PRECISION = 10
 
static const int HLL_LEN = 1024
 

Detailed Description

Collection of builtin aggregate functions. Aggregate functions implement the various phases of the aggregation: Init(), Update(), Serialize(), Merge(), and Finalize(). Not all functions need to implement all of the steps and some of the parts can be reused across different aggregate functions. This functions are implemented using the UDA interface.

Definition at line 30 of file aggregate-functions.h.

Member Function Documentation

template<typename T >
template DecimalVal impala::AggregateFunctions::AppxMedianFinalize< DecimalVal > ( FunctionContext ,
const StringVal src 
)
static
DoubleVal impala::AggregateFunctions::AvgFinalize ( FunctionContext ctx,
const StringVal val 
)
static
DoubleVal impala::AggregateFunctions::AvgGetValue ( FunctionContext ctx,
const StringVal val 
)
static
void impala::AggregateFunctions::AvgInit ( FunctionContext ctx,
StringVal dst 
)
static

Implementation of Avg. TODO: Change this to use a fixed-sized BufferVal as intermediate type.

Definition at line 131 of file aggregate-functions.cc.

References impala_udf::FunctionContext::Allocate(), impala_udf::AnyVal::is_null, impala_udf::StringVal::len, and impala_udf::StringVal::ptr.

void impala::AggregateFunctions::AvgMerge ( FunctionContext ctx,
const StringVal src,
StringVal dst 
)
static
template<typename T >
template void impala::AggregateFunctions::AvgRemove< DoubleVal > ( FunctionContext ctx,
const T &  src,
StringVal dst 
)
static
template<typename T >
template void impala::AggregateFunctions::AvgUpdate< DoubleVal > ( FunctionContext ctx,
const T &  src,
StringVal dst 
)
static
void impala::AggregateFunctions::CountMerge ( FunctionContext ,
const BigIntVal src,
BigIntVal dst 
)
static
void impala::AggregateFunctions::CountRemove ( FunctionContext ,
const AnyVal src,
BigIntVal dst 
)
static
void impala::AggregateFunctions::CountStarRemove ( FunctionContext ,
BigIntVal dst 
)
static
void impala::AggregateFunctions::CountStarUpdate ( FunctionContext ,
BigIntVal dst 
)
static
void impala::AggregateFunctions::CountUpdate ( FunctionContext ,
const AnyVal src,
BigIntVal dst 
)
static

Implementation of Count and Count(*)

Definition at line 93 of file aggregate-functions.cc.

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

DecimalVal impala::AggregateFunctions::DecimalAvgFinalize ( FunctionContext ctx,
const StringVal val 
)
static
void impala::AggregateFunctions::DecimalAvgInit ( FunctionContext ctx,
StringVal dst 
)
static
void impala::AggregateFunctions::DecimalAvgMerge ( FunctionContext ctx,
const StringVal src,
StringVal dst 
)
static
void impala::AggregateFunctions::DecimalAvgRemove ( FunctionContext ctx,
const DecimalVal src,
StringVal dst 
)
static

Definition at line 240 of file aggregate-functions.cc.

References DecimalAvgAddOrRemove().

void impala::AggregateFunctions::DecimalAvgUpdate ( FunctionContext ctx,
const DecimalVal src,
StringVal dst 
)
static

Definition at line 235 of file aggregate-functions.cc.

References DecimalAvgAddOrRemove().

BigIntVal impala::AggregateFunctions::DenseRankGetValue ( FunctionContext ctx,
StringVal src 
)
static

Returns the result for DENSE_RANK and prepares the state for the next Update(). TODO: Implement DENSE_RANK with a single BigIntVal. Requires src can be modified, AggFnEvaluator would need to handle copying the src AnyVal back into the src slot.

Definition at line 1207 of file aggregate-functions.cc.

References impala::RankState::count, impala_udf::AnyVal::is_null, impala_udf::StringVal::len, impala_udf::StringVal::ptr, and impala::RankState::rank.

void impala::AggregateFunctions::DenseRankUpdate ( FunctionContext ctx,
StringVal dst 
)
static

Update state for DENSE_RANK.

Definition at line 1190 of file aggregate-functions.cc.

template<typename T >
template void impala::AggregateFunctions::FirstValRewriteUpdate< DecimalVal > ( FunctionContext ,
const T &  src,
const BigIntVal ,
T *  dst 
)
static

Implements FIRST_VALUE for some windows that require rewrites during planning. The BigIntVal is unused by FirstValRewriteUpdate() (it is used by the AnalyticEvalNode).

Definition at line 1295 of file aggregate-functions.cc.

template<typename T >
void impala::AggregateFunctions::FirstValUpdate ( FunctionContext ctx,
const T &  src,
T *  dst 
)
static
template<typename T >
template StringVal impala::AggregateFunctions::HistogramFinalize< DecimalVal > ( FunctionContext ,
const StringVal src 
)
static

Returns an equi-depth histogram computed from a sample of data produced via reservoir sampling. The result is a comma-separated list of up to 100 histogram bucket endpoints where each bucket contains the same number of elements. For example, "10, 50, 60, 100" would mean 25% of values are less than 10, 25% are between 10 and 50, etc.

Definition at line 957 of file aggregate-functions.cc.

References impala_udf::FunctionContext::Free(), impala_udf::AnyVal::is_null, impala_udf::StringVal::len, impala::NUM_BUCKETS, impala::ReservoirSampleState< T >::num_samples, impala_udf::StringVal::ptr, and impala::ReservoirSampleState< T >::samples.

uint64_t impala::AggregateFunctions::HllFinalEstimate ( const uint8_t *  buckets,
int32_t  num_buckets 
)
static

Utility method to compute the final result of an HLL estimation from num_buckets estimates.

Definition at line 1033 of file aggregate-functions.cc.

References HLL_LEN.

Referenced by HllFinalize().

BigIntVal impala::AggregateFunctions::HllFinalize ( FunctionContext ctx,
const StringVal src 
)
static
void impala::AggregateFunctions::HllInit ( FunctionContext ctx,
StringVal slot 
)
static
void impala::AggregateFunctions::HllMerge ( FunctionContext ctx,
const StringVal src,
StringVal dst 
)
static
void impala::AggregateFunctions::InitNull ( FunctionContext ,
AnyVal dst 
)
static

Initializes dst to NULL.

Definition at line 62 of file aggregate-functions.cc.

References impala_udf::AnyVal::is_null.

Referenced by impala::Expr::InitBuiltinsDummy().

void impala::AggregateFunctions::InitNullString ( FunctionContext c,
StringVal dst 
)
static

Initializes dst to NULL and sets dst->ptr to NULL.

Definition at line 398 of file aggregate-functions.cc.

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

template<typename T >
void impala::AggregateFunctions::InitZero ( FunctionContext ,
T *  dst 
)
static

Initializes dst to 0.

Definition at line 67 of file aggregate-functions.cc.

template<>
void impala::AggregateFunctions::InitZero ( FunctionContext ,
DecimalVal dst 
)
DoubleVal impala::AggregateFunctions::KnuthStddevFinalize ( FunctionContext context,
const StringVal val 
)
static

Calculates STDDEV, uses KnuthVar Init-Update-Merge functions.

Definition at line 1151 of file aggregate-functions.cc.

References impala::ComputeKnuthVariance(), impala::KnuthVarianceState::count, impala_udf::AnyVal::is_null, impala_udf::StringVal::len, and impala_udf::StringVal::ptr.

DoubleVal impala::AggregateFunctions::KnuthStddevPopFinalize ( FunctionContext context,
const StringVal val 
)
static

Calculates the biased STDDEV, uses KnuthVar Init-Update-Merge functions.

Definition at line 1160 of file aggregate-functions.cc.

References impala::ComputeKnuthVariance(), impala::KnuthVarianceState::count, impala_udf::AnyVal::is_null, impala_udf::StringVal::len, and impala_udf::StringVal::ptr.

DoubleVal impala::AggregateFunctions::KnuthVarFinalize ( FunctionContext context,
const StringVal val 
)
static
void impala::AggregateFunctions::KnuthVarInit ( FunctionContext context,
StringVal val 
)
static

Knuth's variance algorithm, more numerically stable than canonical stddev algorithms; reference implementation: http://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Online_algorithm

Definition at line 1094 of file aggregate-functions.cc.

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

void impala::AggregateFunctions::KnuthVarMerge ( FunctionContext context,
const StringVal src,
StringVal dst 
)
static
DoubleVal impala::AggregateFunctions::KnuthVarPopFinalize ( FunctionContext context,
const StringVal val 
)
static

Calculates the biased variance, uses KnuthVar Init-Update-Merge functions.

Definition at line 1142 of file aggregate-functions.cc.

References impala::ComputeKnuthVariance(), impala::KnuthVarianceState::count, impala_udf::AnyVal::is_null, impala_udf::StringVal::len, and impala_udf::StringVal::ptr.

template<typename T >
template void impala::AggregateFunctions::KnuthVarUpdate ( FunctionContext context,
const T &  input,
StringVal val 
)
static
template<typename T >
void impala::AggregateFunctions::LastValRemove ( FunctionContext ctx,
const T &  src,
T *  dst 
)
static
template<typename T >
void impala::AggregateFunctions::LastValUpdate ( FunctionContext ctx,
const T &  src,
T *  dst 
)
static

Implements LAST_VALUE.

Definition at line 1232 of file aggregate-functions.cc.

template<typename T >
void impala::AggregateFunctions::Max ( FunctionContext ,
const T &  src,
T *  dst 
)
static

MaxUpdate/MaxMerge.

Definition at line 393 of file aggregate-functions.cc.

template<>
void impala::AggregateFunctions::Max ( FunctionContext ,
const TimestampVal src,
TimestampVal dst 
)
template<typename T >
void impala::AggregateFunctions::Min ( FunctionContext ,
const T &  src,
T *  dst 
)
static

MinUpdate/MinMerge.

Definition at line 387 of file aggregate-functions.cc.

template<>
void impala::AggregateFunctions::Min ( FunctionContext ,
const TimestampVal src,
TimestampVal dst 
)
template<typename T >
template void impala::AggregateFunctions::OffsetFnInit< DecimalVal > ( FunctionContext ,
T *  dst 
)
static

OffsetFn*() implement LAG and LEAD. Init() sets the default value (the last constant parameter) as dst.

Definition at line 1301 of file aggregate-functions.cc.

References impala_udf::FunctionContext::GetArgType(), impala_udf::FunctionContext::GetConstantArg(), impala_udf::FunctionContext::GetNumArgs(), impala_udf::FunctionContext::IsArgConstant(), and impala_udf::FunctionContext::TypeDesc::type.

template<typename T >
template void impala::AggregateFunctions::OffsetFnUpdate< DecimalVal > ( FunctionContext ,
const T &  src,
const BigIntVal ,
const T &  ,
T *  dst 
)
static

Update() takes all the parameters to LEAD/LAG, including the integer offset and the default value, neither which are needed by Update(). (The offset is already used in the window for the analytic fn evaluation and the default value is set in Init().

Definition at line 1310 of file aggregate-functions.cc.

BigIntVal impala::AggregateFunctions::PcFinalize ( FunctionContext c,
const StringVal src 
)
static
void impala::AggregateFunctions::PcInit ( FunctionContext c,
StringVal slot 
)
static

Probabilistic Counting (PC), a distinct estimate algorithms. Probabilistic Counting with Stochastic Averaging (PCSA) is a variant of PC that runs faster and usually gets equally accurate results.

Definition at line 562 of file aggregate-functions.cc.

References impala_udf::FunctionContext::Allocate(), impala_udf::AnyVal::is_null, impala_udf::StringVal::len, impala::NUM_PC_BITMAPS, impala::PC_BITMAP_LENGTH, and impala_udf::StringVal::ptr.

template<typename T >
template void impala::AggregateFunctions::PcsaUpdate ( FunctionContext ,
const T &  src,
StringVal dst 
)
static
template<typename T >
template void impala::AggregateFunctions::PcUpdate ( FunctionContext ,
const T &  src,
StringVal dst 
)
static
BigIntVal impala::AggregateFunctions::RankFinalize ( FunctionContext ctx,
StringVal src 
)
static

Returns the result for RANK and DENSE_RANK and cleans up intermediate state in src.

Definition at line 1221 of file aggregate-functions.cc.

References impala_udf::FunctionContext::Free(), impala_udf::AnyVal::is_null, impala_udf::StringVal::len, impala_udf::StringVal::ptr, and impala::RankState::rank.

BigIntVal impala::AggregateFunctions::RankGetValue ( FunctionContext ctx,
StringVal src 
)
static

Returns the result for RANK and prepares the state for the next Update().

Definition at line 1192 of file aggregate-functions.cc.

References impala::RankState::count, impala_udf::AnyVal::is_null, impala_udf::StringVal::len, impala_udf::StringVal::ptr, and impala::RankState::rank.

void impala::AggregateFunctions::RankInit ( FunctionContext ctx,
StringVal slot 
)
static

Initializes the state for RANK and DENSE_RANK.

-----------------------—— Analytic Functions ---------------------------—— Analytic functions implement the UDA interface (except Merge(), Serialize()) and are used internally by the AnalyticEvalNode. Some analytic functions store intermediate state as a StringVal which is needed for multiple calls to Finalize(), so some fns also implement a (private) GetValue() method to just return the value. In that case, Finalize() is only called at the end to clean up.

Definition at line 1175 of file aggregate-functions.cc.

References impala_udf::FunctionContext::Allocate(), impala_udf::AnyVal::is_null, impala_udf::StringVal::len, and impala_udf::StringVal::ptr.

void impala::AggregateFunctions::RankUpdate ( FunctionContext ctx,
StringVal dst 
)
static
template<typename T >
template StringVal impala::AggregateFunctions::ReservoirSampleFinalize< DecimalVal > ( FunctionContext ,
const StringVal src 
)
static
template<typename T >
template void impala::AggregateFunctions::ReservoirSampleInit< DecimalVal > ( FunctionContext ,
StringVal slot 
)
static

Reservoir sampling produces a uniform random sample without knowing the total number of items. ReservoirSample{Init, Update, Merge, Serialize} implement distributed reservoir sampling. Samples are first collected locally via reservoir sampling in Update(), and then all local samples are merged together in Merge() using weights proportional to the size of the local input, using 'weighted' reservoir sampling. See the following references for more details: http://dl.acm.org/citation.cfm?id=1138834 http://gregable.com/2007/10/reservoir-sampling.html

Definition at line 792 of file aggregate-functions.cc.

References impala_udf::FunctionContext::Allocate(), impala_udf::AnyVal::is_null, impala_udf::StringVal::len, and impala_udf::StringVal::ptr.

StringVal impala::AggregateFunctions::StringConcatFinalize ( FunctionContext ctx,
const StringVal src 
)
static
void impala::AggregateFunctions::StringConcatMerge ( FunctionContext ctx,
const StringVal src,
StringVal result 
)
static
void impala::AggregateFunctions::StringConcatUpdate ( FunctionContext ctx,
const StringVal src,
StringVal result 
)
static

String concat.

Definition at line 490 of file aggregate-functions.cc.

References impala::DEFAULT_STRING_CONCAT_DELIM.

void impala::AggregateFunctions::StringConcatUpdate ( FunctionContext ctx,
const StringVal src,
const StringVal separator,
StringVal result 
)
static
StringVal impala::AggregateFunctions::StringValGetValue ( FunctionContext ctx,
const StringVal src 
)
static

StringVal GetValue() function that returns a copy of src.

Definition at line 78 of file aggregate-functions.cc.

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

Referenced by StringValSerializeOrFinalize().

StringVal impala::AggregateFunctions::StringValSerializeOrFinalize ( FunctionContext ctx,
const StringVal src 
)
static

StringVal Serialize/Finalize function that copies and frees src.

Definition at line 86 of file aggregate-functions.cc.

References impala_udf::FunctionContext::Free(), impala_udf::AnyVal::is_null, impala_udf::StringVal::ptr, and StringValGetValue().

void impala::AggregateFunctions::SumDecimalAddOrSubtract ( FunctionContext ctx,
const DecimalVal src,
DecimalVal dst,
bool  subtract = false 
)
static

Adds or or subtracts src from dst. Implements Update() and Remove().

Definition at line 362 of file aggregate-functions.cc.

References impala_udf::AnyVal::is_null, impala_udf::DecimalVal::val16, impala_udf::DecimalVal::val4, and impala_udf::DecimalVal::val8.

Referenced by SumDecimalRemove(), and SumDecimalUpdate().

void impala::AggregateFunctions::SumDecimalMerge ( FunctionContext ctx,
const DecimalVal src,
DecimalVal dst 
)
static
void impala::AggregateFunctions::SumDecimalRemove ( FunctionContext ctx,
const DecimalVal src,
DecimalVal dst 
)
static
void impala::AggregateFunctions::SumDecimalUpdate ( FunctionContext ctx,
const DecimalVal src,
DecimalVal dst 
)
static

Sum for decimals.

Definition at line 348 of file aggregate-functions.cc.

References SumDecimalAddOrSubtract().

template<typename SRC_VAL , typename DST_VAL >
template void impala::AggregateFunctions::SumRemove< DoubleVal, DoubleVal > ( FunctionContext ,
const SRC_VAL &  src,
DST_VAL *  dst 
)
static
template<typename SRC_VAL , typename DST_VAL >
template void impala::AggregateFunctions::SumUpdate< DoubleVal, DoubleVal > ( FunctionContext ,
const SRC_VAL &  src,
DST_VAL *  dst 
)
static
TimestampVal impala::AggregateFunctions::TimestampAvgFinalize ( FunctionContext ctx,
const StringVal val 
)
static
TimestampVal impala::AggregateFunctions::TimestampAvgGetValue ( FunctionContext ctx,
const StringVal val 
)
static

Member Data Documentation

const int impala::AggregateFunctions::HLL_LEN = 1024
static

Definition at line 175 of file aggregate-functions.h.

Referenced by HllFinalEstimate(), HllInit(), HllMerge(), and HllUpdate().

const int impala::AggregateFunctions::HLL_PRECISION = 10
static

Hyperloglog distinct estimate algorithm. See these papers for more details. 1) Hyperloglog: The analysis of a near-optimal cardinality estimation algorithm (2007) 2) HyperLogLog in Practice (paper from google with some improvements)

Definition at line 174 of file aggregate-functions.h.

Referenced by HllUpdate().


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