1 | //===----------------------------------------------------------------------===// |
2 | // DuckDB |
3 | // |
4 | // duckdb/storage/table/persistent_segment.hpp |
5 | // |
6 | // |
7 | //===----------------------------------------------------------------------===// |
8 | |
9 | #pragma once |
10 | |
11 | #include "duckdb/storage/table/column_segment.hpp" |
12 | #include "duckdb/storage/block.hpp" |
13 | #include "duckdb/storage/buffer_manager.hpp" |
14 | #include "duckdb/storage/uncompressed_segment.hpp" |
15 | |
16 | namespace duckdb { |
17 | |
18 | class PersistentSegment : public ColumnSegment { |
19 | public: |
20 | PersistentSegment(BufferManager &manager, block_id_t id, idx_t offset, TypeId type, idx_t start, idx_t count, |
21 | data_t stats_min[], data_t stats_max[]); |
22 | |
23 | //! The buffer manager |
24 | BufferManager &manager; |
25 | //! The block id that this segment relates to |
26 | block_id_t block_id; |
27 | //! The offset into the block |
28 | idx_t offset; |
29 | //! The uncompressed segment that the data of the persistent segment is loaded into |
30 | unique_ptr<UncompressedSegment> data; |
31 | |
32 | public: |
33 | void InitializeScan(ColumnScanState &state) override; |
34 | //! Scan one vector from this transient segment |
35 | void Scan(Transaction &transaction, ColumnScanState &state, idx_t vector_index, Vector &result) override; |
36 | //! Scan one vector from this transient segment, throwing an exception if there are any outstanding updates |
37 | void IndexScan(ColumnScanState &state, Vector &result) override; |
38 | //! Scan the next vector from the column and apply a selection vector to filter the data |
39 | void FilterScan(Transaction &transaction, ColumnScanState &state, Vector &result, SelectionVector &sel, |
40 | idx_t &approved_tuple_count) override; |
41 | //! Executes the filters directly in the table's data |
42 | void Select(Transaction &transaction, ColumnScanState &state, Vector &result, SelectionVector &sel, |
43 | idx_t &approved_tuple_count, vector<TableFilter> &tableFilter) override; |
44 | //! Fetch the base table vector index that belongs to this row |
45 | void Fetch(ColumnScanState &state, idx_t vector_index, Vector &result) override; |
46 | //! Fetch a value of the specific row id and append it to the result |
47 | void FetchRow(ColumnFetchState &state, Transaction &transaction, row_t row_id, Vector &result, |
48 | idx_t result_idx) override; |
49 | |
50 | //! Perform an update within the segment |
51 | void Update(ColumnData &column_data, Transaction &transaction, Vector &updates, row_t *ids, idx_t count) override; |
52 | }; |
53 | |
54 | } // namespace duckdb |
55 | |