sparrow-ipc 0.3.0
Loading...
Searching...
No Matches
sparrow_ipc::dictionary_cache Class Reference

Caches dictionaries during deserialization. More...

#include <dictionary_cache.hpp>

Public Member Functions

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.
 

Detailed Description

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.

Member Function Documentation

◆ 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
idThe 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
idThe 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
Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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
idThe dictionary ID
batchThe dictionary data as a single-column record batch
is_deltaIf true, append values to existing dictionary with the same ID
Exceptions
std::invalid_argumentif batch doesn't have exactly one column

The documentation for this class was generated from the following file: