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

Method Put

be/src/util/dict-encoding.h:432–450  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

430
431template<typename T>
432inline int DictEncoder<T>::Put(const T& value) {
433 NodeIndex* bucket = &buckets_[Hash(value) & (HASH_TABLE_SIZE - 1)];
434 NodeIndex i = *bucket;
435 // Look for the value in the dictionary.
436 while (i != Node::INVALID_INDEX) {
437 const Node* n = &nodes_[i];
438 if (LIKELY(n->value == value)) {
439 // Value already in dictionary.
440 buffered_indices_.push_back(i);
441 return 0;
442 }
443 i = n->next;
444 }
445 // Value not found. Add it to the dictionary if there's space.
446 i = nodes_.size();
447 if (UNLIKELY(i >= Node::INVALID_INDEX)) return -1;
448 buffered_indices_.push_back(i);
449 return AddToTable(value, bucket);
450}
451
452template<typename T>
453inline uint32_t DictEncoder<T>::Hash(const T& value) const {

Callers 1

WriteDataMethod · 0.45

Calls 3

HashFunction · 0.85
push_backMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected