Caches dictionaries during deserialization.
More...
#include <dictionary_cache.hpp>
|
| void | store_dictionary (int64_t id, sparrow::record_batch batch, bool is_delta) |
| | Store or update a dictionary.
|
| |
| std::optional< std::reference_wrapper< const sparrow::record_batch > > | get_dictionary (int64_t id) const |
| | Retrieve a cached dictionary.
|
| |
| bool | contains (int64_t id) const noexcept |
| | Check if a dictionary is cached.
|
| |
| void | clear () noexcept |
| | Clear all cached dictionaries.
|
| |
| size_t | size () const noexcept |
| | Get the number of cached dictionaries.
|
| |
Caches dictionaries during deserialization.
This class stores dictionaries received from DictionaryBatch messages and provides them when reconstructing dictionary-encoded arrays. Delta updates append dictionary values to existing dictionaries with the same ID.
Dictionaries are stored as single-column record batches and are referenced by their integer ID. Multiple fields can share the same dictionary by referencing the same ID.
Definition at line 25 of file dictionary_cache.hpp.
◆ clear()
| void sparrow_ipc::dictionary_cache::clear |
( |
| ) |
|
|
noexcept |
Clear all cached dictionaries.
◆ contains()
| bool sparrow_ipc::dictionary_cache::contains |
( |
int64_t | id | ) |
const |
|
nodiscardnoexcept |
Check if a dictionary is cached.
- Parameters
-
| id | The dictionary ID to check |
- Returns
- true if the dictionary exists in the cache, false otherwise
◆ get_dictionary()
| std::optional< std::reference_wrapper< const sparrow::record_batch > > sparrow_ipc::dictionary_cache::get_dictionary |
( |
int64_t | id | ) |
const |
Retrieve a cached dictionary.
- Parameters
-
| id | The dictionary ID to retrieve |
- Returns
- An optional containing the dictionary if found, std::nullopt otherwise
◆ size()
| size_t sparrow_ipc::dictionary_cache::size |
( |
| ) |
const |
|
nodiscardnoexcept |
Get the number of cached dictionaries.
- Returns
- The number of dictionaries in the cache
◆ store_dictionary()
| void sparrow_ipc::dictionary_cache::store_dictionary |
( |
int64_t | id, |
|
|
sparrow::record_batch | batch, |
|
|
bool | is_delta ) |
Store or update a dictionary.
Stores or updates a dictionary identified by the given ID. If is_delta is true and a dictionary with the same ID already exists, values are appended to the existing dictionary.
- Parameters
-
| id | The dictionary ID |
| batch | The dictionary data as a single-column record batch |
| is_delta | If true, append values to existing dictionary with the same ID |
- Exceptions
-
| std::invalid_argument | if batch doesn't have exactly one column |
The documentation for this class was generated from the following file: