MCPcopy Create free account
hub / github.com/apache/arrow / Upsize

Method Upsize

cpp/src/arrow/util/hashing.h:359–386  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

357 }
358
359 Status Upsize(uint64_t new_capacity) {
360 assert(new_capacity > capacity_);
361 uint64_t new_mask = new_capacity - 1;
362 assert((new_capacity & new_mask) == 0); // it's a power of two
363
364 // Stash old entries and seal builder, effectively resetting the Buffer
365 const Entry* old_entries = entries_;
366 ARROW_ASSIGN_OR_RAISE(auto previous, entries_builder_.FinishWithLength(capacity_));
367 // Allocate new buffer
368 RETURN_NOT_OK(UpsizeBuffer(new_capacity));
369
370 for (uint64_t i = 0; i < capacity_; i++) {
371 const auto& entry = old_entries[i];
372 if (entry) {
373 // Dummy compare function will not be called
374 auto p = Lookup<NoCompare>(entry.h, entries_, new_mask,
375 [](const Payload*) { return false; });
376 // Lookup<NoCompare> (and CompareEntry<NoCompare>) ensure that an
377 // empty slots is always returned
378 assert(!p.second);
379 entries_[p.first] = entry;
380 }
381 }
382 capacity_ = new_capacity;
383 capacity_mask_ = new_mask;
384
385 return Status::OK();
386 }
387
388 hash_t FixHash(hash_t h) const { return (h == kSentinel) ? 42U : h; }
389

Callers

nothing calls this directly

Calls 1

OKFunction · 0.50

Tested by

no test coverage detected