[core] Add manifest sidecars for partition, row-id and bucket pruning - #9743
leaves12138 wants to merge 3 commits into
Conversation
|
I suggest using a single manifest index sidecar organized by Avro block. Partition information would support partition predicate pushdown during planning. Since both partition and row-id information describe the same blocks, they can live in the same block record and share its physical location. A possible layout is: The partition dictionary is shared across the file and can reuse the existing manifest partition encoding, preserving full tuples, types and nulls. Each block only stores dictionary IDs. The block ID is implicit in its position; The two indexes should remain independently usable within each block:
During planning, evaluate the partition predicate against the dictionary once, then check each block's partition IDs and row-id intervals. For conjunctive filters, intersect their candidate block sets. Read the selected blocks and retain the existing entry filtering and ADD/DELETE merge, since block-level matches do not guarantee that the same entry satisfies both predicates. This layout assumes reading the whole sidecar, as the current implementation does. A partition-only query would also read the row-id index bytes. I would start with this simpler layout and consider separate physical sections if measurements show that selective index reads materially improve planning time. |
|
Here is a refined version of the block-oriented layout, keeping the file-level partition dictionary and making each block's two payloads independently extensible. The dictionary stores each complete partition tuple once, using the existing manifest partition serialization. This preserves tuple values and nulls; the scan's existing The encoding bytes identify how to decode the corresponding payload, with separate ID namespaces for partition and row-id payloads. They replace the availability flags:
The container's integers and the encoding-1 payload integers use fixed-width big-endian representation; partition bytes retain their existing serialization. Encoding bytes are interpreted as unsigned IDs. Each payload length counts only its payload bytes, excluding the encoding and length fields. Other nonzero encoding IDs are reserved for future representations. If a reader does not recognize one, it skips exactly that payload length and treats that dimension as unavailable, while still being able to use the other dimension. Lengths must be bounded and validated. The outer For example, There are several important correctness and budget rules:
For conjunctive partition and row-id filters, select each block using: Only an empty candidate block set permits skipping the manifest. Selected blocks still pass through the existing entry filtering and ADD/DELETE merge. This keeps one sidecar and one record per block. It still assumes a bounded whole-sidecar read: payload lengths allow skipping decoding and unknown encodings, but do not by themselves save storage I/O. Index size, block selectivity and planning latency should determine whether selective physical reads are worthwhile later. |
3508a27 to
914897f
Compare
|
We also need to consider adding |
OK, I will add |
62074fa to
07bc780
Compare
2c8e225 to
a408855
Compare
a408855 to
a99a163
Compare
a99a163 to
b04d6b4
Compare
b04d6b4 to
f193030
Compare
Status
This is the tracking draft for the remaining manifest-sidecar integration. Rebased onto master after #9889 merged (including master commit
1b802b9b76). The standalone Java format, codec and golden file now come from master unchanged.The format (#9845), lifecycle (#9886), and Java writer (#9889) PRs are merged. The next extracted PR, #9897, covers Java scan pruning. PyPaimon integration remains in this tracking draft for subsequent review.
Purpose
Use optional manifest sidecars to prune physical Avro blocks by independent partition, row-ID and bucket coverage before normal entry filtering and ADD/DELETE reconciliation.
_EXTRA_FILESreferences only after the immutable sidecar closes successfully.manifest.sidecar.enabled, inheritingmanifest-sort.enabledwhen unset. Java and PyPaimon use the same enablement semantics.-1.PMSCmagic, canonical unsigned varint framing, sorted delta-encoded coverage, fixed row-ID min/max, paired bucket/total-bucket sequences with ZigZag total deltas, and a four-byte big-endian CRC32. No manifest-name hash or sidecar size budget remains.Validation