| 81 | } |
| 82 | |
| 83 | Status GroupingAggregator::Partition::InitHashTable(bool* got_memory) { |
| 84 | DCHECK(aggregated_row_stream != nullptr); |
| 85 | DCHECK(hash_tbl == nullptr); |
| 86 | // We use the upper PARTITION_FANOUT num bits to pick the partition so only the |
| 87 | // remaining bits can be used for the hash table. |
| 88 | // TODO: we could switch to 64 bit hashes and then we don't need a max size. |
| 89 | // It might be reasonable to limit individual hash table size for other reasons |
| 90 | // though. Always start with small buffers. |
| 91 | hash_tbl.reset(HashTable::Create(parent->ht_allocator_.get(), false, 1, nullptr, |
| 92 | 1L << (32 - NUM_PARTITIONING_BITS), PAGG_DEFAULT_HASH_TABLE_SZ)); |
| 93 | // Please update the error message in CreateHashPartitions() if initial size of |
| 94 | // hash table changes. |
| 95 | Status status = hash_tbl->Init(got_memory); |
| 96 | if (!status.ok()) { |
| 97 | hash_tbl->Close(); |
| 98 | hash_tbl.reset(); |
| 99 | } |
| 100 | return status; |
| 101 | } |
| 102 | |
| 103 | Status GroupingAggregator::Partition::SerializeStreamForSpilling() { |
| 104 | DCHECK(!parent->is_streaming_preagg_); |