![]() |
mutable
A Database System for Research and Fast Prototyping
|
This class implements a generic PAX store. More...
#include <PaxStore.hpp>
Public Member Functions | |
PaxStore (const Table &table, uint32_t block_size_in_bytes=BLOCK_SIZE) | |
~PaxStore () | |
virtual std::size_t | num_rows () const override |
Return the number of rows in this store. | |
std::size_t | num_rows_per_block () const |
uint32_t | block_size () const |
uint32_t | offset (uint32_t idx) const |
uint32_t | offset (const Attribute &attr) const |
void | append () override |
Append a row to the store. | |
void | drop () override |
Drop the most recently appended row. | |
const memory::Memory & | memory () const override |
Returns the memory of the store. | |
void | dump (std::ostream &out) const override |
virtual void | dump (std::ostream &out) const=0 |
void | dump () const |
const Table & | table () const |
Static Public Attributes | |
static constexpr std::size_t | ALLOCATION_SIZE = 1UL << 30 |
1 GiB | |
static constexpr uint32_t | BLOCK_SIZE = 1UL << 12 |
4 KiB | |
Private Member Functions | |
void | compute_block_offsets () |
Computes the offsets of the columns within a PAX block, the rows size, the number of rows that fit in a PAX block, and the capacity. | |
Private Attributes | |
memory::LinearAllocator | allocator_ |
the memory allocator | |
memory::Memory | data_ |
the underlying memory containing the data | |
std::size_t | num_rows_ = 0 |
the number of rows in use | |
std::size_t | capacity_ |
the number of available rows | |
uint32_t * | offsets_ |
the offsets of each column within a PAX block, in bits | |
uint32_t | block_size_ |
the size of a PAX block, in bytes; includes padding | |
std::size_t | num_rows_per_block_ |
the number of rows within a PAX block | |
const Table & | table_ |
the table defining this store's schema | |
This class implements a generic PAX store.
Definition at line 11 of file PaxStore.hpp.
PaxStore::PaxStore | ( | const Table & | table, |
uint32_t | block_size_in_bytes = BLOCK_SIZE |
||
) |
Definition at line 14 of file PaxStore.cpp.
References m::memory::LinearAllocator::allocate(), ALLOCATION_SIZE, allocator_, compute_block_offsets(), and data_.
PaxStore::~PaxStore | ( | ) |
Definition at line 24 of file PaxStore.cpp.
References offsets_.
|
inlineoverridevirtual |
|
inline |
Definition at line 36 of file PaxStore.hpp.
References block_size_.
|
private |
Computes the offsets of the columns within a PAX block, the rows size, the number of rows that fit in a PAX block, and the capacity.
Tries to maximize the number of rows within a PAX block by storing the attributes in descending order of their size, avoiding padding.
Definition at line 29 of file PaxStore.cpp.
References m::Type::alignment(), ALLOCATION_SIZE, block_size_, capacity_, m::Attribute::id, M_insist, m::Table::num_attrs(), num_rows_per_block_, offsets_, m::Type::size(), m::Store::table(), and m::Attribute::type.
Referenced by PaxStore().
|
inlineoverridevirtual |
Drop the most recently appended row.
Implements m::Store.
Definition at line 50 of file PaxStore.hpp.
M_LCOV_EXCL_START void Store::dump | ( | ) | const |
|
overridevirtual |
Implements m::Store.
Definition at line 94 of file PaxStore.cpp.
References m::memory::Memory::addr(), block_size_, capacity_, data_, m::Table::name(), num_rows_, num_rows_per_block_, offsets_, and m::Store::table().
|
virtual |
Implements m::Store.
|
inlineoverridevirtual |
Returns the memory of the store.
Implements m::Store.
Definition at line 56 of file PaxStore.hpp.
References data_.
|
inlineoverridevirtual |
Return the number of rows in this store.
Implements m::Store.
Definition at line 34 of file PaxStore.hpp.
References num_rows_.
|
inline |
Definition at line 35 of file PaxStore.hpp.
References num_rows_per_block_.
|
inline |
Definition at line 42 of file PaxStore.hpp.
References m::Attribute::id, and offset().
Referenced by offset().
|
inline |
Definition at line 38 of file PaxStore.hpp.
References M_insist, offsets_, and m::Store::table().
|
inlineinherited |
Definition at line 36 of file Store.hpp.
Referenced by m::ColumnStore::ColumnStore(), compute_block_offsets(), m::RowStore::compute_offsets(), m::ColumnStore::dump(), dump(), m::RowStore::dump(), m::ColumnStore::memory(), offset(), m::RowStore::offset(), and m::ScanOperator::ScanOperator().
|
staticconstexpr |
1 GiB
Definition at line 14 of file PaxStore.hpp.
Referenced by compute_block_offsets(), and PaxStore().
|
private |
|
staticconstexpr |
4 KiB
Definition at line 19 of file PaxStore.hpp.
|
private |
the size of a PAX block, in bytes; includes padding
Definition at line 27 of file PaxStore.hpp.
Referenced by block_size(), compute_block_offsets(), and dump().
|
private |
the number of available rows
Definition at line 25 of file PaxStore.hpp.
Referenced by append(), compute_block_offsets(), and dump().
|
private |
the underlying memory containing the data
Definition at line 23 of file PaxStore.hpp.
Referenced by dump(), memory(), and PaxStore().
|
private |
the number of rows in use
Definition at line 24 of file PaxStore.hpp.
Referenced by append(), drop(), dump(), and num_rows().
|
private |
the number of rows within a PAX block
Definition at line 28 of file PaxStore.hpp.
Referenced by compute_block_offsets(), dump(), and num_rows_per_block().
|
private |
the offsets of each column within a PAX block, in bits
Definition at line 26 of file PaxStore.hpp.
Referenced by compute_block_offsets(), dump(), offset(), and ~PaxStore().
|
privateinherited |