Repository navigation
Feature: Paimon minmax index - #100160
Feature: Paimon minmax index#100160JiaQiTang98 wants to merge 52 commits into
Conversation
|
Workflow [PR], commit [54f7da6] Summary: ❌
AI ReviewSummaryThis PR adds experimental Paimon per-file min/max pruning, wires it through the current Final VerdictStatus: ✅ Approve LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 238/298 (79.87%) · Uncovered code |
|
The Stress test (arm_msan) failure is fixed by #101239, which should be merged first. After it is merged, please update the branch to include the fix. |
…onPushDown `master` made the third `boolean_context` argument of `ActionsDAGWithInversionPushDown` mandatory (call site updated for the existing `PartitionPruner` in 7af3639). The new `MinMaxIndexPruner` also builds an inverted DAG to analyze a `WHERE`/`PREWHERE` predicate over the per-file min/max stats, which is a filter (truthiness) context, so it passes `boolean_context = true` to match the partition pruner and benefit from the truthiness-preserving rewrites. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Pushed two updates (
|
…ry section After merging master, the in-progress version advanced to 26.7 and a new `26.7` block was added to `SettingsChangesHistory.cpp`. The new `use_paimon_minmax_index_pruning` setting introduced by this PR was still listed under the now-released `26.6` block; since the PR will ship in 26.7, its history entry belongs in the 26.7 block (matching the existing convention of recording a new setting under the in-progress version).
…t run Address review: the per-query file-count check summed `ProfileEvents['EngineFileLikeReadFiles']` over all `system.query_log` rows whose `log_comment` matched `CLICKHOUSE_TEST_UNIQUE_NAME`. That name is derived only from the test name plus the database, so a local rerun against the same server/database left stale rows matching the filter and doubled the reference counts even when pruning was correct. Append a per-run random suffix to the `log_comment` token so the query-log filter matches only this invocation. The suffix is identical for every query in the run, so `ORDER BY log_comment` and the reference output are unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…de too The dense `_VALUE_STATS_COLS` path in `MinMaxIndexPruner::canBePruned` matched a file's value stats to a query column by name, which correctly locates the stats slot, but then decoded the bytes with the *current* schema's `DataType`. That is unsafe under Paimon schema (type) evolution: a change that preserves a column name while changing its physical encoding - e.g. widening `DECIMAL(10, 0)` to `DECIMAL(20, 0)`, which switches `getFieldFromBinaryRow` from the fixed-size to the varlen decode path - makes an older file's stats be misread into a wrong bound, so a file that still contains matching rows could be falsely pruned (or the decode could throw). The legacy (positional) path already fails closed on `file.schema_id != schema_id`; extend that same guard to the dense path so min/max pruning is skipped for any file whose `schema_id` differs from the one this pruner was built from (such files are read in full, which is always correct). For tables that never evolved, every file carries the current `schema_id`, so pruning is unchanged. Addresses the AI review blocker on `src/Storages/ObjectStorage/DataLakes/Paimon/PartitionPruner.cpp`.
The generator caught `Catalog.TableAlreadyExistException` and reused the existing `tests.paimon_minmax_test` table, so re-running the documented regeneration command against an existing warehouse appended three more batches/snapshots instead of rebuilding the canonical 3-file fixture (and could inherit a stale schema from an older generator version). Drop the table first (`ignoreIfNotExists=true`) and recreate it from scratch, so the committed fixture can be regenerated reproducibly. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Reconcile with master's PaimonMetadata refactor. Resolved conflicts: - PaimonMetadata.cpp: kept both the PR's `use_paimon_minmax_index_pruning` and master's `use_paimon_metadata_files_cache` Setting externs. - PaimonMetadata.h: master dropped `using namespace Paimon` and qualified `Paimon::PartitionPruner`; threaded the `minmax_pruner` parameter (qualified `Paimon::MinMaxIndexPruner`) into collectDataFilesFromManifests, collectIncrementalDataFiles, collectDeltaFilesForSnapshot and collectFullScanDataFiles to match the merged .cpp definitions.
|
Picked up the PR: merged the latest Merge / conflict resolution
The Review thread
VerificationBuilt all nine Paimon translation units against the merged tree on ARM — they compile cleanly with no warnings or errors. The committed fixture and |
…ettings history entry to 26.8 The new `MinMax index pruning` docs section read as if pruning applies to any Paimon column, but `canDecodeMinMaxStats` intentionally skips several types - most notably `TIMESTAMP(p)` / `TIMESTAMP WITH LOCAL TIME ZONE(p)` with `p > 3`, which includes Paimon's default `p = 6` when the precision is omitted. A user could therefore enable `use_paimon_minmax_index_pruning` on a table with a plain `TIMESTAMP` column and assume pruning was active while it was silently disabled for that column. Document the supported type list and the two other cases where a file is never pruned (non-zero or unknown null count, and a file written under an older schema). Also move the `use_paimon_minmax_index_pruning` entry in `SettingsChangesHistory.cpp` from the released `26.7` block to `26.8`, the version currently in progress, and give it a real description.
|
Picked up the PR again: merged the latest MergeThe branch was ~2994 commits / about a week behind. This time I also moved the Review thread[docs/en/sql-reference/table-functions/paimon.md:124] Document the min-max pruning support boundary — fixed. The section read as if pruning applied to any Paimon column, while CIAll three red jobs on the previous head were unrelated to Paimon, and two of them are already fixed on
@groeneai, could you investigate #110133 (the |
|
Investigated. No separate fix is needed: #110133 is already fixed on master by your own #110048, and the red on this PR is base staleness rather than a live bug. I have linked the one still-open PR for the signature on the issue: #110133 (comment) The blocking Since the merge: 22166 runs of Your master merge at The still-open #109747 is unrelated to this PR's red. It stops the planner aborting the server on any argument-type mismatch during partial-result evaluation, instead of only removing the one way #110048 produced that mismatch. |
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 189/229 (82.53%) · Uncovered code |
`master` moved the documentation from the Docusaurus tree under `docs/en/**/*.md` to the Mintlify tree at `docs/**/*.mdx`, deleting every file this branch edits. The edits are replayed at the new paths: - `docs/en/sql-reference/table-functions/paimon.md` -> `docs/reference/functions/table-functions/paimon.mdx`
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
Only the stripped binary is compared: the official master build keeps debug symbols while PR builds strip them, so the other binaries differ by construction. Object file sizes9 object files changed (+96.78 KiB total), 0 added.
737 more object files are built by the master warmup baseline only (it builds every object-file target, a pull request build only Compile time of recompiled translation units34 translation units recompiled, 391 s compile time in total, 34 of them have a recent master baseline. |
…runing docs to the source registration Two review findings on the Paimon min-max index pruning. **Legacy positional value statistics.** A data file whose value statistics carry no `_VALUE_STATS_COLS` column list can only be addressed positionally, and `MinMaxIndexPruner::canBePruned` assumed that stats position `i` always describes table schema field `i`. That assumption breaks for a file written with a projected write schema - for example write columns `[f0, f2]` of a table whose schema is `[f0, f1, f2]` - where a predicate on `f1` would read `f2`'s bounds and `mayBeTrueInRange` could prune a file that still contains matching rows. Checking `file.schema_id == schema_id` does not cover this, because a projected write schema is a projection *of the current schema*. A projection is a subset of the schema, so it is detectable by its cardinality: a statistics row that covers every field must be the full schema, in schema order. `legacyValueStatsArePositional` now requires the arity encoded in the `BinaryRow` header of both the min and the max row, and the length of the parallel `_NULL_COUNTS` array, to agree with the number of schema fields; otherwise pruning is skipped for that file and the file is read in full, which is always correct. The same length agreement is now also required between `_VALUE_STATS_COLS` and the statistics rows in the dense path, so a position derived from the column list can never address past the row. `BinaryRow::getArity` is added for this - the arity is stored in the row header and is the only self-describing part of the layout. The committed `paimon_minmax_test` fixture takes the legacy path (its `_VALUE_STATS_COLS` is an empty array) and its statistics rows have arity 10 for a 10-field schema, so `04051_paimon_minmax_pruning` is unaffected. The new `gtest_paimon_minmax_stats_layout` covers the rejected layouts, including the projected-write-schema case, plus the `BinaryRow` arity accessor. **Docs.** The `Partition pruning` / `MinMax index pruning` sections had been added directly to `docs/reference/functions/table-functions/paimon.mdx` inside its `AUTOGENERATED_START` / `AUTOGENERATED_END` region, which keeps the `Docs check (Mintlify)` job red on `No direct edits to generated or read-only docs`. They are moved to the table function registration text in `TableFunctionObjectStorage.cpp`, which is the source the page is generated from, and the generated page is reverted to its `master` content. While moving them, the list of cases in which a file is never pruned gained the new legacy statistics layout case.
|
🕵 Picked up the PR again: merged the latest MergeThe branch was ~3485 commits behind. The merge was clean - Blocker: legacy positional value statisticsFirst, a correction to the finding's premise: the committed The reported hole is real, though: I fixed it by making the layout self-check rather than by plumbing a write-column mapping through The same length agreement is now also required in the dense path between
I chose this over the "fail closed whenever Tests. The fixture's statistics rows have arity A Nit: docs edited inside the generated regionCorrect - the CIThe one remaining red job besides the docs check is Verification
|
|
This PR suggests redesigning after #112702 is completed. Should this RFC prove feasible, the current PR will not be required. |
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Supports Paimon min-max index pushdown by setting
use_paimon_minmax_index_pruning=1Documentation entry for user-facing changes