JingsongLi commented on code in PR #9845:
URL: https://github.com/apache/paimon/pull/9845#discussion_r4022176666


##########
docs/docs/concepts/spec/manifest.md:
##########
@@ -63,6 +63,227 @@ skip manifests before opening them.
 Each extra file belongs exclusively to one manifest. It is retained and 
cleaned up together with
 that manifest during snapshot, tag, or changelog deletion.
 
+### Manifest Sidecar
+
+`ManifestSidecar` provides a binary sidecar for selecting complete Avro 
manifest blocks
+using independent partition, row-ID and bucket coverage. A sidecar uses the
+`<manifest-file-name>.avro.sidecar` naming convention. Readers find it through 
an explicit
+`.avro.sidecar` reference in the manifest metadata's `_EXTRA_FILES`, without 
probing a
+derived file name. The Avro schemas and `_VERSION` identifiers remain 
unchanged.
+
+The utility includes construction, validation, block selection and optional 
caching. Table
+writers and scans do not yet invoke it automatically. Callers are responsible 
for publishing
+sidecar references, managing file ownership, applying entry filters and 
reconciling ADD/DELETE
+entries after block selection. `build` returns null without opening files when 
`Settings.write`
+is false. Otherwise it reads the completed physical manifest and returns 
sidecar bytes; it does
+not write or publish another file.
+
+`Settings` contains `write` and `read` switches for the calling writer and 
scan, and enables
+row-ID and bucket payload generation independently. Partition generation is 
always enabled,
+including the empty partition tuple for unpartitioned tables. Missing or 
invalid
+metadata makes only the affected block's dimension unavailable. There is no 
sidecar byte budget:
+construction keeps complete coverage and `read` consumes the entire file once 
it is opened.
+
+`read` returns null immediately when `Settings.read` is false, without 
inspecting metadata,
+accessing the cache or opening files. An absent sidecar reference or an 
`IOException` also
+returns null, allowing the caller to fall back to the manifest. If the thread 
is interrupted, the I/O failure is propagated as
+`UncheckedIOException`. Other exceptions and errors propagate unchanged. 
`select` validates
+supplied bytes directly and reports invalid containers with `IOException`.
+
+Version 1 uses the following layout. Container `int` and `long` fields are 
signed, fixed-width
+4-byte and 8-byte big-endian integers. Encoding IDs are unsigned bytes with 
separate namespaces.
+Payload counts and envelopes use the same fixed-width types; delta streams use 
the
+variable-length encoding described below.
+
+```text
+magic : 4 bytes                         // ASCII PMSC
+formatVersion : int                    // 1
+manifestLength : long
+manifestEntryCount : long               // ADD + DELETE
+avroHeaderLength : int
+avroHeader : bytes                      // original schema, codec and sync 
marker
+partitionCount : int
+partitionDictionary[]
+  partitionByteLength : int
+  partitionBytes : bytes                // existing manifest BinaryRow 
serialization
+blockCount : int
+blocks[]                               // original physical order
+  offset : long
+  length : long                         // complete encoded block, including 
sync marker
+  recordCount : long
+  partitionEncoding : byte
+  if partitionEncoding != 0:
+    partitionPayloadLength : int
+    partitionPayload : bytes
+  rowIdEncoding : byte
+  if rowIdEncoding != 0:
+    rowIdPayloadLength : int
+    rowIdPayload : bytes
+  bucketEncoding : byte
+  if bucketEncoding != 0:
+    bucketPayloadLength : int
+    bucketPayload : bytes
+checksum : 32 bytes                     // SHA-256 of all preceding bytes
+```
+
+The block ID is its position. Its first entry ordinal is the sum of preceding 
record counts
+and is not stored. Each complete partition tuple appears once in the 
dictionary, including
+all its fields and nulls. The scan's partition type interprets the existing 
serialized tuple.
+Partition predicates are evaluated once per dictionary entry.
+
+| Dimension | Encoding | Payload |
+| --- | --- | --- |
+| Any | `0` | Unavailable; only the encoding byte is present. |
+| Partition | `1` | Count and delta/varint-compressed sorted unique dictionary 
IDs. |
+| Row ID | `1` | Interval count, minimum, span, and delta/varint-compressed 
interior endpoints. |

Review Comment:
   Sorted?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to