@@ -46,20 +46,20 @@ class Predicate;
4646enum class PAIMON_EXPORT RealtimeStoreMode {
4747 APPEND_ONLY ,
4848 PRIMARY_KEY ,
49+ // / Experimental mode whose persisted data and index formats may change in future releases.
50+ DEDUPLICATE ,
4951};
5052
51- // / Parameters used by a `RealtimeStoreFactory` to create a store.
53+ // / Parameters used to create a real-time store.
5254struct PAIMON_EXPORT RealtimeStoreCreateRequest {
53- // / Schema whose ownership is transferred to the factory. Append mode receives the complete
54- // / append store-write schema: [_REALTIME_OFFSET, table write fields]. Primary-key mode receives
55- // / the real-time primary-key store-write schema:
56- // / [_SEQUENCE_NUMBER, _VALUE_KIND, _REALTIME_OFFSET, table write fields].
55+ // / Physical write schema whose ownership is transferred to the consumer. Its layout is
56+ // / mode-specific and contains a non-null int64 `_REALTIME_OFFSET` field.
5757 std::unique_ptr<::ArrowSchema> write_schema;
5858 // / Table options available to the store implementation.
5959 std::map<std::string, std::string> options;
6060 // / Memory pool for allocations retained by the store.
6161 std::shared_ptr<MemoryPool> memory_pool;
62- // / Table mode implemented by the store.
62+ // / Requested store mode .
6363 RealtimeStoreMode mode = RealtimeStoreMode::APPEND_ONLY ;
6464 // / Statistics collected by the store for query pruning.
6565 StatisticsMode statistics_mode = StatisticsMode::NONE ;
@@ -69,6 +69,9 @@ struct PAIMON_EXPORT RealtimeStoreCreateRequest {
6969 // / File system used to access `temp_directory`. The default store retains shared ownership
7070 // / for its lifetime. Custom stores may ignore this hint.
7171 std::shared_ptr<FileSystem> file_system = nullptr ;
72+ // / User-defined deduplicate key field names when key-based deduplication is configured; empty
73+ // / otherwise.
74+ std::vector<std::string> deduplicate_key_fields = {};
7275};
7376
7477// / A record batch and its application-assigned offset bounds.
@@ -77,9 +80,9 @@ struct PAIMON_EXPORT RealtimeStoreCreateRequest {
7780// / [_REALTIME_OFFSET, table write fields], and offsets are strictly increasing before the batch
7881// / enters the store. Primary-key batches use the real-time primary-key store-write schema, are
7982// / sorted by full primary key then sequence number, and retain the original offset in
80- // / `_REALTIME_OFFSET`. `offset_range` is the left-closed, right-open envelope from the first
81- // / application offset through one past the last; offsets may have gaps, so its count is not the
82- // / batch row count.
83+ // / `_REALTIME_OFFSET`.
84+ // / `offset_range` is the left-closed, right-open envelope from the first application offset through
85+ // / one past the last; offsets may have gaps, so its count is not the batch row count.
8386struct PAIMON_EXPORT RealtimeWriteBatch {
8487 // / Input batch whose ownership is transferred to `RealtimeStore::Write`.
8588 std::unique_ptr<RecordBatch> batch;
@@ -170,9 +173,8 @@ class PAIMON_EXPORT RealtimeStore {
170173 // / Creates readers that expose all rows in a sealed segment for Paimon file writing.
171174 // /
172175 // / The returned readers collectively expose every sealed row exactly once. Append-mode readers
173- // / preserve write order and contain `_REALTIME_OFFSET` followed by the table write fields.
174- // / Primary-key readers contain the real-time primary-key store fields; each reader's complete
175- // / stream is sorted by full primary key then sequence number.
176+ // / preserve write order. Primary-key reader streams are sorted by full primary key then
177+ // / sequence number. Returned batches match the mode-specific physical write schema.
176178 // / Returned readers have independent mutable read state and may be operated concurrently with
177179 // / one another without external synchronization.
178180 virtual Result<std::vector<std::unique_ptr<BatchReader>>> CreateCommitReaders (
@@ -215,7 +217,6 @@ class PAIMON_EXPORT RealtimeStoreFactory {
215217 virtual ~RealtimeStoreFactory () = default ;
216218
217219 // / Creates a store configured with the supplied schema, statistics, options, and memory pool.
218- // / Creates a store for the requested table mode.
219220 // / The factory consumes `request`, including ownership of `request.write_schema`.
220221 virtual Result<std::shared_ptr<RealtimeStore>> Create (RealtimeStoreCreateRequest&& request) = 0;
221222};
0 commit comments