MCPcopy Create free account
hub / github.com/apache/impala / PcUpdate

Method PcUpdate

be/src/exprs/aggregate-functions-ir.cc:1528–1541  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1526
1527template<typename T>
1528void AggregateFunctions::PcUpdate(FunctionContext* c, const T& input, StringVal* dst) {
1529 DCHECK_EQ(dst->len, PC_INTERMEDIATE_BYTES);
1530 if (input.is_null) return;
1531 // Core of the algorithm. This is a direct translation of the code in the paper.
1532 // Please see the paper for details. For simple averaging, we need to compute hash
1533 // values NUM_PC_BITMAPS times using NUM_PC_BITMAPS different hash functions (by using a
1534 // different seed).
1535 for (int i = 0; i < NUM_PC_BITMAPS; ++i) {
1536 uint32_t hash_value = AnyValUtil::Hash(input, *c->GetArgType(0), i);
1537 const int bit_index = BitUtil::CountTrailingZeros(hash_value, PC_BITMAP_LENGTH - 1);
1538 // Set bitmap[i, bit_index] to 1
1539 SetDistinctEstimateBit(dst->ptr, i, bit_index);
1540 }
1541}
1542
1543template<typename T>
1544void AggregateFunctions::PcsaUpdate(FunctionContext* c, const T& input, StringVal* dst) {

Callers

nothing calls this directly

Calls 3

HashFunction · 0.85
SetDistinctEstimateBitFunction · 0.85
GetArgTypeMethod · 0.80

Tested by

no test coverage detected