feat(querier): rfc 0022 green pt2 — promoted predicate compile (RFC0022.3/.4/.6) - #346
Conversation
…iles ListingTableConfig::infer_schema infers from the first table path only, and resolve_data_urls produces per-file URLs — so the schema the scan (and now the RFC 0022 predicate compile) saw was one arbitrary file's, not the RFC 0005 §3.9 union the surrounding comment claimed. Harmless before because every consumer of an absent OPTIONAL column degrades correctly; load-bearing once attr_match gates promoted-column arms on the union schema. Infer per file and Schema::try_merge — no new IO class, the Parquet format already reads every listed footer for statistics at plan time. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
RFC0022.3/.4/.6 go green. attr_match compiles the §3.3 two-arm form when the scanned union schema carries the key's promoted column (==/!= keep the P-IS-NULL JSON fallback for pre-amendment files and non-string values; ordering/regex are typed-arm-only with the documented silent non-match on NULL), addressed via an unqualified Column since col() would parse the dotted names as qualified references. Non-promoted keys keep the #146 LIKE behaviour; the rejection text moves to 'non-promoted attributes support only == / !='. The pre-amendment file is a committed fixture (RFC 0021 §6 discipline, #[ignore]d generator) since every current writer path implicitly promotes service.name. RFC0022.5/.7 stay stubbed for the pruning slice. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Warning Review limit reached
Next review available in: 53 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR implements RFC 0022 promoted attribute columns end-to-end: parquet prefix constants become public, the query compiler detects and uses promoted ChangesPromoted attribute columns support
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant Test as RFC0022 Test
participant Writer as Fixture Writer
participant Querier as Querier::execute
participant Compile as attr_match Compiler
participant Schema as Union Schema
Test->>Writer: write pre/post amendment records with PromotedAttributes
Test->>Querier: submit QueryRequest
Querier->>Schema: infer per-file schemas and merge (try_merge)
Querier->>Compile: compile attribute predicate against union schema
Compile->>Compile: check if promoted column exists
alt promoted column exists
Compile-->>Querier: NULL-aware promoted Expr with JSON fallback
else promoted column absent
Compile-->>Querier: JSON LIKE Expr (== / != only)
end
Querier-->>Test: results or QueryError::InvalidQuery
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
Implements the query-side predicate compilation needed for RFC 0022 promoted attribute columns, ensuring mixed scans (pre-/post-amendment Parquet files) compile predicates correctly against the true union schema while keeping the read path projection-blind.
Changes:
- Add promoted-column-aware attribute predicate compilation (two-arm fallback for
==/!=, typed-only for ordering/regex when promoted). - Fix table schema inference to merge schemas across all scanned files (true union) instead of relying on first-path inference.
- Implement RFC0022.3/.4/.6 integration tests and add shared test fixtures for writing with explicit promoted sets.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| crates/ourios-querier/tests/rfc0022_attr_columns.rs | Implements RFC0022.3/.4/.6 tests and fixture installation/generation logic for pre-amendment Parquet coverage. |
| crates/ourios-querier/tests/common/mod.rs | Adds test helpers to write Parquet with explicit promoted attributes and to build records with both resource/log attributes. |
| crates/ourios-querier/src/lib.rs | Ensures scan schema is the merged union across all scanned files by inferring per-file schema and merging. |
| crates/ourios-querier/src/compile.rs | Extends attribute predicate compilation to use promoted columns when present, with fallback to JSON LIKE for legacy/non-promoted cases. |
| crates/ourios-parquet/src/promoted.rs | Exposes promoted column-name prefixes for shared derivation between writer and querier compile. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
… idiom Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
RFC 0022 green pt2 — the query-side predicate compile. Discharges §5 scenarios RFC0022.3 (pre-amendment parity), RFC0022.4 (operator gating), and RFC0022.6 (projection-blind read path);
.5/.7stay stubbed for the pruning slice.What
attr_matchtwo-arm compile (§3.3). When the scanned union schema carries a key's promoted column (resource.<k>/attr.<k>— §3.4's compile rule),==/!=compile to the typed armOR (P IS NULL AND <JSON arm>)fallback, and ordering/regex compile against the typed arm only (pre-amendment rows readNULLand silently never match, per §3.3). Non-promoted keys keep the feat(querier): compile the DSL IR to the execution layer (RFC0002.1/.3/.4/.5/.6) #146 JSON-LIKEbehaviour exactly; the rejection text moves to "non-promoted attributes support only == / != in this query surface". Promoted columns are addressed viaExpr::Column(Column::new_unqualified(..))(dotted names would parse as qualified references undercol()).ourios-querier/src/lib.rs). Latent bug:ListingTableConfig::infer_schemainfers from the first table path only, andresolve_data_urlsproduces per-file URLs — so the "union" the old comment claimed was actually "whichever file listed first" (nondeterministic). Harmless before because every consumer of an absent column degraded correctly; load-bearing now that predicate compilation gates on the union schema. The querier infers per file andSchema::try_merges. No extra IO class: the Parquet format already fetches every listed file's footer for statistics at plan time.testdata/rfc0022/pre-amendment.parquet(the RFC 0021 §6 fixture discipline), since every current writer path implicitly promotesservice.nameand can no longer produce a pre-amendment schema. The#[ignore]d generator test documents/regenerates it.write_all_with_promoted/rec_with_attrsin the shared querier fixtures;RESOURCE_PREFIX/ATTR_PREFIXexported fromourios_parquet::promotedso the compiler derives column names from the same constants the writer declares.Scenario mapping
LIKE(no promoted column in its union schema — the exact pre-RFC 0022 code path); assertscombined == pre_only + post_onlyper query plus template-scoped row identity./loginin the pre-amendment file would match>= "/ch"but must not); non-promoted keys (present in the JSON!) still reject withInvalidQuery;==/!=unchanged both sides. The fixture's installed filename sorts before the writer's UUIDv7 names so a regression to first-file schema inference fails deterministically.LogRow(Debug-scan asserted).Invariants / hazards (CLAUDE.md §3/§4)
#[ignore]d red stubs are implemented and un-ignored; no existing test weakened or deleted.Verification
cargo fmt --all --check,cargo clippy --all-targets --all-features -- -D warnings,cargo test --all-features— all green locally (114 suite blocks, 0 failures).Remaining for RFC 0022 green:
.5(pruning oracle) +.7(promoted-set drift) in the pruning slice;storage.promoted_attributesconfig plumbing (RFC 0020 schema extension, §3.2) as its own follow-up slice.🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes
Tests