Repository navigation
fix(layout): list only what the definition query keeps in tables and charts - #3555
Conversation
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Code reviewI reviewed the whole diff (9 files) against Bugs: None found. I traced the table and chart paths. The Security: None found. The change does not touch inputs, I/O or secrets. Performance:
Quality:
AGENTS.md: No breaks found. Checked: no Twins checked: Confidence: High that the logic is correct on reading. Not verified by compiling or running tests. Change sizeCompared with the base branch: the whole PR against main (merge base e11b061 to PR head 744d7ca).
|
Code reviewI reviewed the full diff against Bugs
Security
Performance
Quality
AGENTS.md
Checked for twins
Prior reviews
Change sizeCompared: the whole PR against main (merge base e11b061 to PR head 6d23ac6).
|
📖 Docs preview
GitHub Pages takes a minute or two to publish a new commit. Newer commits from the fork aren't published until a maintainer adds the |
Code reviewReviewed the full PR (12 files) against Bugs
Security
Performance
Quality
AGENTS.md
Prior review threads
Change sizeCompared with the base branch: merge base
|
Code reviewThis PR makes layout tables and charts list only the rows their layer's definition query keeps, at the frame's scale and on the series page shown. I traced every reader of the new path: the page draw, the table cut and notices ( Bugs
Security
Performance
Quality
AGENTS.md
Already raised, left aloneFive earlier threads are on this PR. I did not post new comments on them:
Change sizeCompared with the base branch (merge base e11b061 to PR head c4063cb). The size figures are file bytes from
|
| /// count, and no table is counted while the series index can't be read, as the page isn't drawn | ||
| /// then. Each table's layer has its definition query read over it, once a call, besides the read | ||
| /// that draws it: what an export or a report pays to say them (#3478). | ||
| pub fn tables_cut(layout: &Layout, maps: &[Map], dpi: f64) -> Vec<TableCut> { |
There was a problem hiding this comment.
New per-page cost on the export paths. tables_cut now runs table_listing(...).count() for every visible table of the layout, and each call reads that table's definition query over its whole layer. Its callers repeat that work per page:
crates/engine/src/cmd/layout/export.rs:322calls it inside the per-page loop of the PNG/PDF export (progress::stepper page), so an N-page series export does N full query passes per query-filtered table on the layout.crates/engine/src/cmd/report.rs:1420(keep_tables) does the same per page of a report.
Before this change an unsorted, unselected table counted in O(1), so this cost is new. The series index differs per page, so the count can't simply be reused across pages, and the pass has no look at Cancel. A layer of tens of millions of rows makes each page's cut seconds of work that Cancel only sees between pages.
The doc above notes the cost for one call, but not that the export and report loops multiply it. Either state that multiplication in the doc of tables_cut and at those two call sites, or skip tables whose layer has no query before anything else, or keep the page's kept rows for the cut and the draw so the read happens once per page.
Confidence: high on the code path, medium on the magnitude (not measured).
Category: performance
Code reviewBugs
Security
Performance
Quality (nits, left for the release quality pass)
AGENTS.md
Earlier concerns left alone: 6 threads already on this PR (query-pass cost on the UI thread, the silent fallback for a query that doesn't compile, the silence when the series index can't be read, the per-table count in Change sizeCompared with the base branch: the whole PR against main (merge base e11b061 to PR head c4063cb).
|
Summary
A layout's table and chart listed every feature of their layer, including those its definition query hides on the map frame.
Layer::query_rows_with), at the frame's scale and on the series page shown, so a query on@page_numberor@page_feature_idlists the page's features.Reach: desktop, browser, phone, command line, Python, the Assistant and MCP draw through the same path. Undo and reopening need nothing new. No new interface strings.
Testing
engine/src/tests/layout_definition_query.rs(the drawn page of a table and of ungrouped, grouped and stacked charts equals that of a layer holding only the kept features; selected rows; a series page; undo; the notices). A unit test inrustgis-mapcovers the query read on a page, and a line in the streamed@row_numbertest covers a layer read in place. A review round addedone_tables_cut_is_its_own_of_the_pagesinrustgis-render.e364531b: fmt, clippy-D warnings, doctests, layers and schema check pass; nextest 11930 passed, 8 failed, all outside this diff on this machine (7 inrustgis-geolibreandline_strokes_editor_edits_one_class).c4063cb5: fmt, clippy-D warningsonrustgis-map,rustgis-renderandrustgis-engine, and their layout, chart, table and guide tests without the DuckDB one (1161 passed). The wasm32 web build with-D warningspassed at869a3380; only comments and the user guide changed after it.ui_shotbefore and after.UI evidence
Table and chart with the definition query
name IN ('Tokyo','Lima','Cairo'), before and after:Related issue
Closes #3478.
Summary by CodeRabbit