Skip to content

Commit 74f3e5d

Browse files
authored
Merge branch 'main' into feature/spill-to-disk
2 parents ae865a9 + d184ecf commit 74f3e5d

43 files changed

Lines changed: 1999 additions & 147 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

include/paimon/catalog/identifier.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@
1616

1717
#pragma once
1818

19+
#include <optional>
1920
#include <string>
2021

22+
#include "paimon/result.h"
2123
#include "paimon/type_fwd.h"
2224
#include "paimon/visibility.h"
2325

@@ -27,18 +29,32 @@ namespace paimon {
2729
class PAIMON_EXPORT Identifier {
2830
public:
2931
static const char kUnknownDatabase[];
32+
static const char kSystemTableSplitter[];
33+
static const char kSystemBranchPrefix[];
34+
static const char kDefaultMainBranch[];
3035

3136
explicit Identifier(const std::string& table);
3237
Identifier(const std::string& database, const std::string& table);
3338

3439
bool operator==(const Identifier& other);
3540
const std::string& GetDatabaseName() const;
3641
const std::string& GetTableName() const;
42+
Result<std::string> GetDataTableName() const;
43+
Result<std::optional<std::string>> GetBranchName() const;
44+
Result<std::string> GetBranchNameOrDefault() const;
45+
Result<std::optional<std::string>> GetSystemTableName() const;
46+
Result<bool> IsSystemTable() const;
3747
std::string ToString() const;
3848

3949
private:
50+
Status SplitTableName() const;
51+
4052
const std::string database_;
4153
const std::string table_;
54+
mutable bool parsed_ = false;
55+
mutable std::string data_table_;
56+
mutable std::optional<std::string> branch_;
57+
mutable std::optional<std::string> system_table_;
4258
};
4359

4460
} // namespace paimon

include/paimon/schema/schema.h

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,16 @@ class PAIMON_EXPORT Schema {
5757
/// failure.
5858
virtual Result<FieldType> GetFieldType(const std::string& field_name) const = 0;
5959

60+
/// Get an optional comment describing the schema object.
61+
/// @return The comment if set, or std::nullopt otherwise.
62+
virtual std::optional<std::string> Comment() const = 0;
63+
};
64+
65+
/// Schema contract for data tables.
66+
class PAIMON_EXPORT DataSchema : public Schema {
67+
public:
68+
~DataSchema() override = default;
69+
6070
/// Get the unique identifier of this table schema.
6171
/// @return The schema id
6272
virtual int64_t Id() const = 0;
@@ -86,10 +96,12 @@ class PAIMON_EXPORT Schema {
8696
/// Get the table-level options associated with this schema.
8797
/// @return A reference to the map of option key-value pairs (e.g., file format, filesystem).
8898
virtual const std::map<std::string, std::string>& Options() const = 0;
99+
};
89100

90-
/// Get an optional comment describing the table.
91-
/// @return The table comment if set, or std::nullopt otherwise.
92-
virtual std::optional<std::string> Comment() const = 0;
101+
/// Schema contract for system tables.
102+
class PAIMON_EXPORT SystemSchema : public Schema {
103+
public:
104+
~SystemSchema() override = default;
93105
};
94106

95107
} // namespace paimon

include/paimon/table/source/table_read.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ class PAIMON_EXPORT TableRead {
6666
protected:
6767
explicit TableRead(const std::shared_ptr<MemoryPool>& memory_pool);
6868

69+
std::shared_ptr<MemoryPool> GetMemoryPool() const {
70+
return pool_;
71+
}
72+
6973
private:
7074
std::shared_ptr<MemoryPool> pool_;
7175
};

include/paimon/utils/roaring_bitmap64.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,19 @@ class PAIMON_EXPORT RoaringBitmap64 {
7474
/// @param x value added to bitmap
7575
void Add(int64_t x);
7676

77+
/// Bulk-insert `n` values into the bitmap.
78+
///
79+
/// Compared to repeatedly calling `Add`, this implementation:
80+
/// 1. Buckets the input values by their high-32 bits in a single pass.
81+
/// 2. Feeds each bucket to the inner 32-bit Roaring's true-batch
82+
/// `addMany(uint32_t*)` path, which performs container-level bulk
83+
/// insertion.
84+
///
85+
/// This avoids the per-value `std::map` lookup of the 64-bit wrapper and
86+
/// the per-value insertion overhead inside the 32-bit array container.
87+
/// Values may be unsorted; ordering is handled internally.
88+
void AddMany(size_t n, const int64_t* values);
89+
7790
/// @param x value added to bitmap
7891
/// @return false if contain x; true if not contain x
7992
bool CheckedAdd(int64_t x);

src/paimon/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,11 @@ set(PAIMON_CORE_SRCS
314314
core/table/source/table_read.cpp
315315
core/table/source/table_scan.cpp
316316
core/table/source/data_evolution_batch_scan.cpp
317+
core/table/system/options_system_table.cpp
318+
core/table/system/system_table.cpp
319+
core/table/system/system_table_read.cpp
320+
core/table/system/system_table_scan.cpp
321+
core/table/system/system_table_schema.cpp
317322
core/tag/tag.cpp
318323
core/utils/field_mapping.cpp
319324
core/utils/file_store_path_factory.cpp

src/paimon/common/global_index/btree/btree_defs.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,16 @@ struct BtreeDefs {
4141
static inline const char kBtreeIndexHighPriorityPoolRatio[] =
4242
"btree-index.high-priority-pool-ratio";
4343

44+
/// "btree-index.read-buffer-size" - Optional. Specifies the read buffer size for the B-tree
45+
/// index. This setting can be tuned based on query patterns:
46+
/// - For range queries (e.g., `VisitLessThan`, `VisitGreaterOrEqual`), increasing the buffer
47+
/// size (e.g., to 1MB) may improve I/O bandwidth and sequential read performance.
48+
/// - For point queries (e.g., `VisitEqual`), buffering can introduce negative effects due to
49+
/// read amplification; it is recommended to leave this option unset.
50+
///
51+
/// If specified, read block with `BufferedInputStream`.
52+
static inline const char kBtreeIndexReadBufferSize[] = "btree-index.read-buffer-size";
53+
4454
static inline const char kDefaultBtreeIndexBlockSize[] = "64KB";
4555
static inline const char kDefaultBtreeIndexCompression[] = "none";
4656
static inline const char kDefaultBtreeIndexCacheSize[] = "128MB";

0 commit comments

Comments
 (0)