1717
1818 Write
1919=====
20- Batch writing requires the compute engine to pre-bucket data (bucket), using the
21- same bucketing strategy as Paimon to ensure correct `` Scan `` behavior, and to
22- specify the target `` partition ``. Data should be accumulated into `` RecordBatch ``
23- and written to Paimon .
20+ Batch writing requires the compute engine to specify the target `` partition ``.
21+ For fixed-bucket tables, the engine must also assign a valid bucket to every
22+ `` RecordBatch ``. In unaware-bucket and postpone-bucket modes, the writer can
23+ resolve the bucket automatically when it is omitted .
2424
2525Paimon C++ uses Apache Arrow as the :ref: `in-memory columnar format<memory-format> `
2626to more efficiently support writing to disk columnar formats such as ORC,
@@ -33,7 +33,6 @@ Parquet, and Avro, thereby improving write throughput.
3333
3434 Not supported in the current scope:
3535 - Changelog
36- - Indexes
3736
3837Bucketing Modes
3938---------------
@@ -56,9 +55,15 @@ RecordBatch Construction
5655
5756- The compute engine must:
5857
59- - Apply the Paimon-consistent bucketing function to each row prior to batching.
6058 - Assign the correct ``partition `` for each row.
61- - Group rows into Arrow ``RecordBatch `` per partition-bucket combination to minimize writer state changes and I/O overhead.
59+ - In fixed-bucket mode, apply the Paimon-consistent bucketing function, set a
60+ bucket in ``[0, bucket) ``, and group rows into Arrow ``RecordBatch `` objects
61+ per partition-bucket combination.
62+
63+ - In unaware-bucket mode (append table with ``bucket = -1 ``), an omitted bucket
64+ is resolved to ``0 ``.
65+ - In postpone-bucket mode (primary-key table with ``bucket = -2 ``), an omitted
66+ bucket is resolved to ``-2 ``.
6267
6368- Recommended practices:
6469
@@ -122,26 +127,27 @@ produce a correct ``Snapshot``, which commonly includes (but is not limited to):
122127
123128.. note ::
124129
125- Current C++ scope supports Append and PK tables. Changelog is out of
126- scope and should not be emitted in ``CommitMessage `` until
127- explicitly supported.
130+ The C++ writer supports Append and PK tables and can produce
131+ ``CommitMessage `` objects for both. ``FileStoreCommit `` currently executes
132+ local commits only for append-only tables on non-object-store file systems.
133+ PK and object-store commit messages must be sent to an external control
134+ plane. Changelog is out of scope and should not be emitted in
135+ ``CommitMessage `` until explicitly supported.
128136
129137Serialization and Deserialization
130138~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
131139
132- - Binary Format:
133- - The binary payload must strictly conform to Java Paimon’s ``CommitMessage `` encoding.
134- - Version tags or schema identifiers should be included to enable forwards/backwards compatibility and safe upgrades.
135-
136- - Serialization API:
137- - Provide a function to serialize the writer’s commit state into a byte buffer (or stream) consumable by Java Paimon.
138-
139- - Deserialization API:
140- - Provide a function to parse a Java-produced ``CommitMessage `` binary payload back into C++ commit structures for verification, replay, and testing.
141-
142- - Validation:
143- - Include conformance tests to assert that C++ serialized payloads are accepted by Java Paimon.
144- - Include round-trip tests to ensure C++ can parse Java-produced payloads and vice versa for supported message versions.
140+ - **Binary format: ** The binary payload must strictly conform to Java Paimon's
141+ ``CommitMessage `` encoding. It does not contain a version tag, so callers
142+ must transport ``CommitMessage::CurrentVersion() `` separately and supply it
143+ when deserializing.
144+ - **Serialization API: ** Use ``CommitMessage::Serialize `` for one message or
145+ ``CommitMessage::SerializeList `` for a list.
146+ - **Deserialization API: ** Use ``CommitMessage::Deserialize `` or
147+ ``CommitMessage::DeserializeList `` with the separately supplied
148+ serialization version.
149+ - **Validation: ** Conformance and round-trip tests must verify compatibility
150+ with Java Paimon for supported message versions.
145151
146152Operational Flow
147153~~~~~~~~~~~~~~~~~~~~~~~
@@ -155,12 +161,15 @@ Operational Flow
155161
1561623. Each writer invokes ``PrepareCommit ``, which:
157163 - Aggregates per-writer state into a ``CommitMessage ``.
158- - Serializes the message into a Java-compatible binary payload .
164+ - Returns `` CommitMessage `` objects; it does not serialize them .
159165
160- 4. The compute engine gathers ``CommitMessages `` from all writers.
166+ 4. The compute engine gathers ``CommitMessage `` objects from all writers. For
167+ cross-process transport, it explicitly calls ``Serialize `` or
168+ ``SerializeList `` and carries ``CurrentVersion() `` alongside the payload.
161169
162- 5. The compute engine issues a ``Commit `` request to the control plane with the
163- collected messages, resulting in a new ``Snapshot ``.
170+ 5. For a supported local append-table commit, the engine passes the objects to
171+ ``FileStoreCommit ``. For PK tables or object-store paths, it sends the
172+ serialized payload and version to an external control plane.
164173
165- 6. The coordinator validates the messages, updates manifests/metadata, and
166- finalizes the snapshot atomically.
174+ 6. The local committer or external coordinator validates the messages, updates
175+ manifests/metadata, and finalizes the snapshot atomically.
0 commit comments