Repository navigation
perf(r2rml): prune star TriplesMap fan-out — all-members intersection + disjoint-class hint (PR-3) - #1484
Closed
aaj3f wants to merge 9 commits into
Closed
perf(r2rml): prune star TriplesMap fan-out — all-members intersection + disjoint-class hint (PR-3)#1484aaj3f wants to merge 9 commits into
aaj3f wants to merge 9 commits into
Conversation
… + disjoint-class hint (PR-3) A same-subject star resolved its TriplesMaps by BASE predicate alone, so a typed dim star sharing a common predicate (edw:name) fanned out to every name-bearing table (q001: 6 loadTables/scans for a 500-row single-table query). Two provably-safe resolution prunes behind FLUREE_R2RML_STAR_TM_PRUNE (default on): (a) All-members intersection: only TMs supplying EVERY star predicate can produce a complete star row; resolution filters to that intersection. The all-members-required assumption is pinned by test (optional members never fuse into stars). (b') Disjoint-class hint: when the star's co-located class was NOT fused (class in a different TM) but wildcard_class_fusion_is_safe proves every non-class TM subject-template-disjoint from the class-declaring TMs, prune resolution to the class TMs — the standalone class scan joined on subject would drop the pruned rows anyway. Resolution-only; rdf:type emission and materialization unchanged. The ROADMAP's original fix (b) (prune to class-declaring TMs whenever fusion is refused) was proven UNSOUND under vertical partitioning (counterexample in ROADMAP annotation; regression test class_prune_hint_refused_under_vertical_partition). Crawl-side fan-out needed no work: already class-constrained (81b0ec6). Live SF01 (16-core host): q001 cold 14.18s -> 2.94s (4.8x), load_table n=6 -> 1; switch-off faithfully reproduces the fan-out. Native corpus 55 queries, 0 hash mismatches; q022/q054 sentinels hash-OK. q002/q042 mismatch proven PRE-EXISTING (identical both switch states): native/virtual IRI-serialization divergence, filed as F9 (product decision escalated). Suites: query 1200/1200 (6 new tests), api all bins green.
… crossed-write duplicate)
This was referenced Jul 13, 2026
Closed
cargo fmt --all --check fails on four hunks of this PR's own delta (operator.rs star-fanout block, rewrite.rs disjoint-class-hint + tests) with rustfmt from stable 1.97.0 — what CI's dtolnay/rust-toolchain@stable resolves. CI never ran here (ci.yml triggers only on base=main), flagged by the #1476 review stack-wide note.
…ormation gap on record Two optional items from the PR-3 review: - One switch helper for the R2RML family: the five fluree-db-query boolean switches (LIMIT_PUSHDOWN, STAR_TM_PRUNE, SCAN_CACHE, FILTER_CONSUMPTION, CRAWL_CLASS_FUSION) had drifted into two falsy spelling sets (0/false/off vs 0/false/off/no). All now route through r2rml::env_switch_enabled (0/false/off/no — the superset; the only behavior change is that "no" now disables the three switches that previously ignored it, aligning with the documented family intent). The fluree-db-api crawl helper and the fluree-db-iceberg footer switch already match these spellings; cross-crate symbol sharing isn't possible without a new common home, so they stay mirrored and are cross-referenced from the helper doc. - F10 filed: the pre-existing split-member star-formation gap (required same-subject members split across template-sharing TriplesMaps yield zero star rows; native would subject-join) is now a registered residual in 04-findings-register.md plus a ROADMAP §PR-3 residual note, with cross-refs at the two seams (tm_passes_star_prune doc, rewrite star-fusion loop). Pre-existing and preserved (not caused) by fix (a)'s intersection prune; future fix in the rewrite — refuse to fuse when no TM covers all members. The review's blocking fmt item was already cleared by the per-PR rustfmt commits (cargo fmt --all --check green at this HEAD); the OnceLock-idiom aside for the #1482 footer switch landed in 0590613. Gates: fluree-db-query 1260/1260 (nextest); scoped clippy 0 errors; fmt --all --check green.
Contributor
Author
|
Consolidating at maintainer request. #1484 (PR-3 — the star |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Roadmap PR-3 (
docs/audit/2026-07-virtual-dataset-perf/ROADMAP.md): the F8 star over-scan. A same-subject star resolved TriplesMaps by its base predicate alone, so a typed dimension star sharing a common predicate (edw:name) fanned out to every name-bearing table — 6 loadTables + 6 scans for a 500-row single-table query, tripling cold latency on the most common query shape.The prunes (both behind
FLUREE_R2RML_STAR_TM_PRUNE, default on)(a) All-members intersection. Only TriplesMaps supplying every star predicate can produce a complete star row; resolution filters to that intersection. The load-bearing all-members-required assumption is pinned by test (OPTIONAL members never fuse into stars — verified + guarded).
(b') Disjoint-class hint. When the star's co-located class was not fused (class lives in a different TM) but
wildcard_class_fusion_is_safeproves every non-class TM subject-template-disjoint from the class-declaring TMs, resolution prunes to the class TMs — the standalone class scan joined on subject would drop the pruned rows anyway. Resolution-only:rdf:typeemission and materialization are untouched.Crawl-side fan-out: no work needed — already class-constrained since
81b0ec601(#1450); residual 429 backoff remains roadmap PR-8.Live results (SF01, 16-core host)
q022/q054 sentinels hash-OK; native corpus 55 queries, 0 hash mismatches.
q002/q042 mismatch: pre-existing, filed as F9
Both mismatch identically with the switch on and off ⇒ not this PR. Root cause (head-row diff): native compacts predicate/type IRIs to CURIEs (
edw:name), virtual emits full IRIs — all values byte-identical after namespace folding. Unmasked by PR-0's row-count fix. Filed as F9 in the findings register with the which-side-conforms product decision escalated (SPARQL 1.1 results-JSON favors full IRIs, but changing native output affects existing users). No harness masking — they stay honestly red until decided.Gates
query suite 1200/1200 (6 new tests: intersection prune, class-hint prune, vertical-partition refusal, optional-member guard, switch-off fan-out, disjointness edge); api all bins green; native 0 hash mismatches; live table above.
Stacks on #1482 (PR-2) ← #1478 (PR-1) ← #1476 (PR-0) ← #1475 ← #1450.
Review follow-ups (7b21684)
cargo fmt --all -- --checkgreen at HEAD via the per-PR rustfmt commits (12102a075+ inherited stack passes).04-findings-register.mdF10 + ROADMAP §PR-3 residual note + cross-refs attm_passes_star_pruneand the rewrite star-fusion loop. Future fix in the rewrite (refuse to fuse when no TM covers all members); preserved, not caused, by fix (a).fluree-db-queryR2RML switches now route through oneenv_switch_enabledhelper with a single falsy spelling set (0/false/off/no); thefluree-db-apicrawl helper andfluree-db-icebergfooter switch already mirror it (cross-referenced — no common crate to share the symbol). The perf(iceberg): eliminate per-file footer round-trips + raise decode concurrency (PR-2) #1482 OnceLock-idiom aside had already landed in0590613a7.