Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
|
#include <aggregate-functions.h>
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 |
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.
|
static |
Returns an approximate median using reservoir sampling.
Definition at line 981 of file aggregate-functions.cc.
References impala_udf::FunctionContext::Free(), impala_udf::AnyVal::is_null, impala_udf::StringVal::len, impala::ReservoirSampleState< T >::num_samples, impala_udf::StringVal::ptr, and impala::ReservoirSampleState< T >::samples.
|
static |
Definition at line 177 of file aggregate-functions.cc.
References AvgGetValue(), impala_udf::FunctionContext::Free(), and impala_udf::StringVal::ptr.
|
static |
Definition at line 171 of file aggregate-functions.cc.
References impala::AvgState::count, impala_udf::StringVal::ptr, and impala::AvgState::sum.
Referenced by AvgFinalize().
|
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.
|
static |
Definition at line 161 of file aggregate-functions.cc.
References impala::AvgState::count, impala_udf::StringVal::len, impala_udf::StringVal::ptr, and impala::AvgState::sum.
|
static |
Definition at line 149 of file aggregate-functions.cc.
References impala::AvgState::count, impala_udf::StringVal::len, impala_udf::StringVal::ptr, and impala::AvgState::sum.
|
static |
Definition at line 139 of file aggregate-functions.cc.
References impala::AvgState::count, impala_udf::StringVal::len, impala_udf::StringVal::ptr, and impala::AvgState::sum.
|
static |
Definition at line 119 of file aggregate-functions.cc.
References impala_udf::AnyVal::is_null, and impala_udf::BigIntVal::val.
|
static |
Definition at line 104 of file aggregate-functions.cc.
References impala_udf::AnyVal::is_null, and impala_udf::BigIntVal::val.
|
static |
Definition at line 113 of file aggregate-functions.cc.
References impala_udf::AnyVal::is_null, and impala_udf::BigIntVal::val.
|
static |
Definition at line 99 of file aggregate-functions.cc.
References impala_udf::AnyVal::is_null, and impala_udf::BigIntVal::val.
|
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.
|
static |
Definition at line 245 of file aggregate-functions.cc.
References impala::DecimalAvgState::count, impala::ColumnType::DebugString(), impala_udf::FunctionContext::GetArgType(), impala::ColumnType::GetByteSize(), impala_udf::AnyVal::is_null, impala_udf::StringVal::len, impala_udf::StringVal::ptr, impala::DecimalAvgState::sum, impala::AnyValUtil::TypeDescToColumnType(), impala_udf::DecimalVal::val16, impala_udf::DecimalVal::val4, and impala_udf::DecimalVal::val8.
Referenced by DecimalAvgRemove(), and DecimalAvgUpdate().
|
static |
Definition at line 315 of file aggregate-functions.cc.
References DecimalAvgGetValue(), impala_udf::FunctionContext::Free(), and impala_udf::StringVal::ptr.
|
static |
Definition at line 290 of file aggregate-functions.cc.
References impala_udf::FunctionContext::AddWarning(), count, impala::DecimalAvgState::count, impala::ColumnType::CreateDecimalType(), impala::DecimalValue< T >::Divide(), impala_udf::FunctionContext::GetReturnType(), impala_udf::StringVal::ptr, impala_udf::FunctionContext::TypeDesc::scale, impala::DecimalAvgState::sum, impala_udf::FunctionContext::TypeDesc::type, impala::TYPE_DECIMAL, UNLIKELY, impala_udf::DecimalVal::val16, and impala::DecimalValue< T >::value().
Referenced by DecimalAvgFinalize().
|
static |
Avg for decimals.
Definition at line 228 of file aggregate-functions.cc.
References impala_udf::FunctionContext::Allocate(), impala_udf::AnyVal::is_null, impala_udf::StringVal::len, and impala_udf::StringVal::ptr.
|
static |
Definition at line 279 of file aggregate-functions.cc.
References impala::DecimalAvgState::count, impala_udf::StringVal::len, impala_udf::StringVal::ptr, impala::DecimalAvgState::sum, and impala_udf::DecimalVal::val16.
|
static |
Definition at line 240 of file aggregate-functions.cc.
References DecimalAvgAddOrRemove().
|
static |
Definition at line 235 of file aggregate-functions.cc.
References DecimalAvgAddOrRemove().
|
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.
|
static |
Update state for DENSE_RANK.
Definition at line 1190 of file aggregate-functions.cc.
|
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.
|
static |
Implements FIRST_VALUE.
Definition at line 1270 of file aggregate-functions.cc.
References impala_udf::FunctionContext::impl(), impala::FunctionContextImpl::num_removes(), and impala::FunctionContextImpl::num_updates().
void impala::AggregateFunctions::FirstValUpdate | ( | FunctionContext * | ctx, |
const StringVal & | src, | ||
StringVal * | dst | ||
) |
Definition at line 1281 of file aggregate-functions.cc.
References impala_udf::FunctionContext::Allocate(), impala_udf::FunctionContext::impl(), impala_udf::AnyVal::is_null, impala_udf::StringVal::len, impala::FunctionContextImpl::num_removes(), impala::FunctionContextImpl::num_updates(), and impala_udf::StringVal::ptr.
|
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.
|
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().
|
static |
Definition at line 1069 of file aggregate-functions.cc.
References impala_udf::FunctionContext::Free(), HllFinalEstimate(), impala_udf::AnyVal::is_null, impala_udf::StringVal::len, and impala_udf::StringVal::ptr.
|
static |
Definition at line 998 of file aggregate-functions.cc.
References impala_udf::FunctionContext::Allocate(), HLL_LEN, impala_udf::AnyVal::is_null, impala_udf::StringVal::len, and impala_udf::StringVal::ptr.
|
static |
Definition at line 1022 of file aggregate-functions.cc.
References HLL_LEN, impala_udf::AnyVal::is_null, impala_udf::StringVal::len, and impala_udf::StringVal::ptr.
|
static |
Definition at line 1007 of file aggregate-functions.cc.
References impala::HashUtil::FNV64_SEED, impala_udf::FunctionContext::GetArgType(), impala::AnyValUtil::Hash64(), impala::hash_value(), HLL_LEN, HLL_PRECISION, gen_ir_descriptions::idx, impala_udf::AnyVal::is_null, impala_udf::StringVal::len, and impala_udf::StringVal::ptr.
|
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().
|
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.
|
static |
Initializes dst to 0.
Definition at line 67 of file aggregate-functions.cc.
void impala::AggregateFunctions::InitZero | ( | FunctionContext * | , |
DecimalVal * | dst | ||
) |
Definition at line 73 of file aggregate-functions.cc.
References impala_udf::AnyVal::is_null, and impala_udf::DecimalVal::val16.
|
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.
|
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.
|
static |
Definition at line 1134 of file aggregate-functions.cc.
References impala::ComputeKnuthVariance(), impala::KnuthVarianceState::count, and impala_udf::StringVal::ptr.
|
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.
|
static |
Definition at line 1115 of file aggregate-functions.cc.
References impala::KnuthVarianceState::count, impala_udf::AnyVal::is_null, impala_udf::StringVal::len, impala::KnuthVarianceState::m2, impala::KnuthVarianceState::mean, and impala_udf::StringVal::ptr.
|
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.
|
static |
Definition at line 1101 of file aggregate-functions.cc.
References impala::KnuthVarianceState::count, impala_udf::AnyVal::is_null, impala_udf::StringVal::len, impala::KnuthVarianceState::m2, impala::KnuthVarianceState::mean, and impala_udf::StringVal::ptr.
|
static |
Definition at line 1256 of file aggregate-functions.cc.
References impala_udf::FunctionContext::impl(), impala::FunctionContextImpl::num_removes(), and impala::FunctionContextImpl::num_updates().
void impala::AggregateFunctions::LastValRemove | ( | FunctionContext * | ctx, |
const StringVal & | src, | ||
StringVal * | dst | ||
) |
|
static |
Implements LAST_VALUE.
Definition at line 1232 of file aggregate-functions.cc.
void impala::AggregateFunctions::LastValUpdate | ( | FunctionContext * | ctx, |
const StringVal & | src, | ||
StringVal * | dst | ||
) |
Definition at line 1237 of file aggregate-functions.cc.
References impala_udf::FunctionContext::Allocate(), impala_udf::FunctionContext::Free(), impala_udf::AnyVal::is_null, impala_udf::StringVal::len, impala_udf::StringVal::ptr, and impala_udf::FunctionContext::Reallocate().
|
static |
MaxUpdate/MaxMerge.
Definition at line 393 of file aggregate-functions.cc.
void impala::AggregateFunctions::Max | ( | FunctionContext * | ctx, |
const StringVal & | src, | ||
StringVal * | dst | ||
) |
Definition at line 417 of file aggregate-functions.cc.
References impala_udf::FunctionContext::Allocate(), impala_udf::FunctionContext::Free(), impala::StringValue::FromStringVal(), impala_udf::AnyVal::is_null, impala_udf::StringVal::len, and impala_udf::StringVal::ptr.
void impala::AggregateFunctions::Max | ( | FunctionContext * | ctx, |
const DecimalVal & | src, | ||
DecimalVal * | dst | ||
) |
void impala::AggregateFunctions::Max | ( | FunctionContext * | , |
const TimestampVal & | src, | ||
TimestampVal * | dst | ||
) |
Definition at line 472 of file aggregate-functions.cc.
References impala::TimestampValue::FromTimestampVal(), and impala_udf::AnyVal::is_null.
|
static |
MinUpdate/MinMerge.
Definition at line 387 of file aggregate-functions.cc.
void impala::AggregateFunctions::Min | ( | FunctionContext * | ctx, |
const StringVal & | src, | ||
StringVal * | dst | ||
) |
Definition at line 405 of file aggregate-functions.cc.
References impala_udf::FunctionContext::Allocate(), impala_udf::FunctionContext::Free(), impala::StringValue::FromStringVal(), impala_udf::AnyVal::is_null, impala_udf::StringVal::len, and impala_udf::StringVal::ptr.
void impala::AggregateFunctions::Min | ( | FunctionContext * | ctx, |
const DecimalVal & | src, | ||
DecimalVal * | dst | ||
) |
void impala::AggregateFunctions::Min | ( | FunctionContext * | , |
const TimestampVal & | src, | ||
TimestampVal * | dst | ||
) |
Definition at line 459 of file aggregate-functions.cc.
References impala::TimestampValue::FromTimestampVal(), and impala_udf::AnyVal::is_null.
|
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.
|
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.
|
static |
Definition at line 712 of file aggregate-functions.cc.
References impala::DistinceEstimateFinalize(), impala_udf::FunctionContext::Free(), impala_udf::AnyVal::is_null, and impala_udf::StringVal::ptr.
|
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.
|
static |
Definition at line 652 of file aggregate-functions.cc.
References impala::DistinctEstimateBitMapToString(), impala_udf::AnyVal::is_null, impala_udf::StringVal::len, impala::NUM_PC_BITMAPS, impala::PC_BITMAP_LENGTH, impala_udf::StringVal::ptr, and VLOG_ROW.
|
static |
Definition at line 719 of file aggregate-functions.cc.
References impala::DistinceEstimateFinalize(), impala_udf::FunctionContext::Free(), impala_udf::AnyVal::is_null, impala::NUM_PC_BITMAPS, and impala_udf::StringVal::ptr.
|
static |
Definition at line 620 of file aggregate-functions.cc.
References impala_udf::FunctionContext::GetArgType(), impala::AnyValUtil::Hash(), impala::hash_value(), impala::NUM_PC_BITMAPS, impala::PC_BITMAP_LENGTH, impala_udf::StringVal::ptr, impala::SetDistinctEstimateBit(), and UNLIKELY.
|
static |
Definition at line 604 of file aggregate-functions.cc.
References impala_udf::FunctionContext::GetArgType(), impala::AnyValUtil::Hash(), impala::hash_value(), impala::NUM_PC_BITMAPS, impala::PC_BITMAP_LENGTH, impala_udf::StringVal::ptr, impala::SetDistinctEstimateBit(), and UNLIKELY.
|
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.
|
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.
|
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.
|
static |
Update state for RANK.
Definition at line 1183 of file aggregate-functions.cc.
References impala::RankState::count, impala_udf::AnyVal::is_null, impala_udf::StringVal::len, and impala_udf::StringVal::ptr.
|
static |
Returns 20,000 unsorted samples as a list of comma-separated values.
Definition at line 938 of file aggregate-functions.cc.
References impala_udf::FunctionContext::Free(), impala_udf::AnyVal::is_null, impala_udf::StringVal::len, impala::ReservoirSampleState< T >::num_samples, impala_udf::StringVal::ptr, and impala::ReservoirSampleState< T >::samples.
|
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.
|
static |
Definition at line 880 of file aggregate-functions.cc.
References impala_udf::AnyVal::is_null, impala_udf::StringVal::len, impala::NUM_SAMPLES, impala::ReservoirSampleState< T >::num_samples, impala_udf::StringVal::ptr, impala::ReservoirSampleState< T >::samples, and impala::ReservoirSampleState< T >::source_size.
|
static |
Definition at line 819 of file aggregate-functions.cc.
References impala_udf::FunctionContext::Free(), impala_udf::AnyVal::is_null, impala_udf::StringVal::len, impala::ReservoirSampleState< T >::num_samples, impala_udf::StringVal::ptr, impala::ReservoirSampleState< T >::samples, and impala::ReservoirSampleState< T >::source_size.
|
static |
Definition at line 802 of file aggregate-functions.cc.
References impala::ReservoirSampleState< T >::GetNext64(), impala_udf::AnyVal::is_null, impala_udf::StringVal::len, impala::NUM_SAMPLES, impala::ReservoirSampleState< T >::num_samples, impala_udf::StringVal::ptr, impala::ReservoirSampleState< T >::samples, and impala::ReservoirSampleState< T >::source_size.
|
static |
Definition at line 533 of file aggregate-functions.cc.
References impala_udf::FunctionContext::Free(), impala_udf::AnyVal::is_null, impala_udf::StringVal::len, and impala_udf::StringVal::ptr.
|
static |
Definition at line 515 of file aggregate-functions.cc.
References impala_udf::FunctionContext::Allocate(), impala_udf::AnyVal::is_null, impala_udf::StringVal::len, impala_udf::StringVal::ptr, and impala_udf::FunctionContext::Reallocate().
|
static |
String concat.
Definition at line 490 of file aggregate-functions.cc.
References impala::DEFAULT_STRING_CONCAT_DELIM.
|
static |
Definition at line 495 of file aggregate-functions.cc.
References impala_udf::FunctionContext::Allocate(), impala::DEFAULT_STRING_CONCAT_DELIM, impala_udf::AnyVal::is_null, impala_udf::StringVal::len, impala_udf::StringVal::ptr, and impala_udf::FunctionContext::Reallocate().
|
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().
|
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().
|
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().
|
static |
Definition at line 379 of file aggregate-functions.cc.
References impala_udf::AnyVal::is_null, and impala_udf::DecimalVal::val16.
|
static |
Definition at line 353 of file aggregate-functions.cc.
References impala_udf::FunctionContext::impl(), impala::FunctionContextImpl::num_removes(), impala::FunctionContextImpl::num_updates(), and SumDecimalAddOrSubtract().
|
static |
Sum for decimals.
Definition at line 348 of file aggregate-functions.cc.
References SumDecimalAddOrSubtract().
|
static |
Definition at line 335 of file aggregate-functions.cc.
References impala_udf::FunctionContext::impl(), impala::FunctionContextImpl::IncrementNumRemoves(), impala::FunctionContextImpl::num_removes(), and impala::FunctionContextImpl::num_updates().
|
static |
SumUpdate, SumMerge.
Definition at line 323 of file aggregate-functions.cc.
References impala_udf::FunctionContext::impl(), and impala::FunctionContextImpl::IncrementNumUpdates().
|
static |
Definition at line 216 of file aggregate-functions.cc.
References impala_udf::FunctionContext::Free(), impala_udf::StringVal::ptr, and TimestampAvgGetValue().
|
static |
Definition at line 206 of file aggregate-functions.cc.
References impala::AvgState::count, impala_udf::StringVal::ptr, impala::AvgState::sum, and impala::TimestampValue::ToTimestampVal().
Referenced by TimestampAvgFinalize().
|
static |
|
static |
Avg for timestamp. Uses AvgInit() and AvgMerge().
Definition at line 183 of file aggregate-functions.cc.
References impala::AvgState::count, impala::TimestampValue::FromTimestampVal(), impala_udf::AnyVal::is_null, impala_udf::StringVal::len, impala_udf::StringVal::ptr, impala::AvgState::sum, and impala::TimestampValue::ToSubsecondUnixTime().
|
static |
Definition at line 175 of file aggregate-functions.h.
Referenced by HllFinalEstimate(), HllInit(), HllMerge(), and HllUpdate().
|
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().