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

Method HashVariableLenRow

be/src/exec/hash-table.cc:283–310  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

281}
282
283uint32_t HashTableCtx::HashVariableLenRow(const uint8_t* expr_values,
284 const uint8_t* expr_values_null) const {
285 uint32_t hash = seeds_[level_];
286 int var_result_offset = expr_values_cache_.var_result_offset();
287 // Hash the non-var length portions (if there are any)
288 if (var_result_offset != 0) {
289 hash = Hash(expr_values, var_result_offset, hash);
290 }
291
292 for (int i = 0; i < build_exprs_.size(); ++i) {
293 // non-string and null slots are already part of 'expr_values'.
294 if (build_exprs_[i]->type().type != TYPE_STRING &&
295 build_exprs_[i]->type().type != TYPE_VARCHAR) {
296 continue;
297 }
298 const void* loc = expr_values_cache_.ExprValuePtr(expr_values, i);
299 if (expr_values_null[i]) {
300 // Hash the null random seed values at 'loc'
301 hash = Hash(loc, sizeof(StringValue), hash);
302 } else {
303 // Hash the string
304 // TODO: when using CRC hash on empty string, this only swaps bytes.
305 const StringValue* str = reinterpret_cast<const StringValue*>(loc);
306 hash = Hash(str->Ptr(), str->Len(), hash);
307 }
308 }
309 return hash;
310}
311
312template <bool INCLUSIVE_EQUALITY>
313bool HashTableCtx::Equals(const TupleRow* build_row, const uint8_t* expr_values,

Callers

nothing calls this directly

Calls 7

HashFunction · 0.85
var_result_offsetMethod · 0.80
ExprValuePtrMethod · 0.80
sizeMethod · 0.45
typeMethod · 0.45
PtrMethod · 0.45
LenMethod · 0.45

Tested by

no test coverage detected