feat(table): partition-match predicate builder for dynamic overwrite (phase 1)
- Dominant language
- Go
- Stars
- 463
- Forks
- 232
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 121
Description
Phase 1 of #1215.
## What
Add an internal, transform-aware helper that, given the current partition spec and a deduplicated set of partition tuples (as produced by `DataFile.Partition()`, keyed by partition field ID), returns a `BooleanExpression` matching exactly those partitions and nothing else.
## Shape
- Input: the partition spec plus a set of partition tuples (field-ID → already-transformed value).
- Output: an OR of per-partition predicates; each per-partition predicate is an AND across the spec's fields. A null partition value maps to `IsNull`; a present value maps to an equality built through the field's `Transform`, not an identity-only switch on Go types.
- Deduplicate tuples canonically so repeated partitions collapse into one predicate.
- Empty input maps to `AlwaysFalse`.
## Why standalone
This is the only genuinely new logic in the feature and the part most likely to need iteration (transform handling, null semantics). Landing it alone keeps the Phase 2 wiring trivial and the predicate independently testable.
## Open design point
The mechanism for non-identity transforms (e.g. matching files in `bucket(x) = 3` or `day(ts) = N`) needs to be settled here so Phase 2 can consume it directly — either a source-column row predicate where the transform is invertible, or partition-level matching against the manifest tuple. Resolving this is part of the phase.
## Tests
- Identity transform, single and multiple fields.
- Non-identity transform (bucket / day) handled correctly.
- Null partition value → `IsNull`.
- Duplicate tuples dedup to a single predicate.
- Empty set → `AlwaysFalse`.
## Parity
Mirror partition matching in `BaseReplacePartitions` / PyIceberg `_build_partition_predicate`.
Contributor guide
Assessment
This issue has not been assessed yet.