16 , offsets_(new uint32_t[table.num_attrs() + 1])
17 , block_size_(block_size_in_bytes)
36 for (uint32_t pos = 0; pos != num_attrs; ++pos)
37 attrs[pos] = &
table()[pos];
40 std::stable_sort(attrs, attrs + num_attrs, [](
const Attribute *first,
const Attribute *second) {
46 uint64_t alignment = 8;
47 std::size_t num_not_byte_aligned = 0;
48 for (uint32_t pos = 0; pos != num_attrs; ++pos) {
54 ++num_not_byte_aligned;
59 uint64_t row_size_ = off;
69 auto max_num_rows_per_block = (
block_size_ * 8) / row_size_;
75 uint32_t running_bit_offset = 0;
76 for (uint32_t pos = 0; pos != num_attrs; ++pos) {
81 running_bit_offset += 8 - bit_offset;
84 M_insist(
offsets_[num_attrs] % 8 == 0,
"NULL bitmap column must be byte aligned");
98 for (uint32_t i = 0, end =
table().num_attrs(); i != end; ++i) {
99 if (i != 0) out <<
", ";
102 out <<
']' << std::endl;
107static
void register_store()
__attribute__((constructor(202))) static void register_interpreter()
const PrimitiveType * type
the type of the attribute
std::size_t id
the internal identifier of the attribute, unique within its table
The catalog contains all Databases and keeps track of all meta information of the database system.
ThreadSafePooledString pool(const char *str) const
Creates an internalized copy of the string str by adding it to the internal StringPool.
static Catalog & Get()
Return a reference to the single Catalog instance.
void register_store(ThreadSafePooledString name, const char *description=nullptr)
Registers a new Store with the given name.
This class implements a generic PAX store.
uint32_t block_size_
the size of a PAX block, in bytes; includes padding
static constexpr std::size_t ALLOCATION_SIZE
1 GiB
void compute_block_offsets()
Computes the offsets of the columns within a PAX block, the rows size, the number of rows that fit in...
memory::Memory data_
the underlying memory containing the data
std::size_t num_rows_per_block_
the number of rows within a PAX block
std::size_t num_rows_
the number of rows in use
memory::LinearAllocator allocator_
the memory allocator
PaxStore(const Table &table, uint32_t block_size_in_bytes=BLOCK_SIZE)
std::size_t capacity_
the number of available rows
uint32_t * offsets_
the offsets of each column within a PAX block, in bits
Defines a generic store interface.
const Table & table() const
A table is a sorted set of attributes.
virtual const ThreadSafePooledString & name() const =0
Returns the name of the Table.
virtual std::size_t num_attrs() const =0
Returns the number of attributes in this table.
virtual uint64_t alignment() const
Compute the alignment requirement in bits of an instance of this type.
virtual uint64_t size() const
Compute the size in bits of an instance of this type.
Memory allocate(std::size_t size) override
Creates a new memory object with size bytes of freshly allocated memory.
void * addr() const
Returns a pointer to the beginning of the virtual address space where this allocation is mapped to.