Repository navigation
fix(analysis): Pivot Table says which cells it rounded past 2^53 - #1388
Conversation
Pivot Table writes its statistics as decimals, which hold whole numbers exactly only up to 2^53, so a SUM, MAX, FIRST or MEDIAN of larger Integer values came out rounded without a word. Summary Statistics, Dissolve and Summarize Within already check each result and say how many were rounded and in which fields. Pivot Table now runs the same check on each cell and gives the same notices: how many cells were rounded, naming the pivot fields that hold them, and how many whole numbers written as text past the 64-bit range a statistic read as decimals. Values placed without a statistic keep the value field's type and get no notice.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Code reviewI found no bugs, security problems or AGENTS.md violations in this PR. I checked the diff against Bugs: None found. The per-cell check uses the same Security: None found. The changed code has no indexing or unwraps in non-test code ( Performance: Nothing significant. With a statistic set, the change adds one extra O(n) column pass for the text count and one Quality (low confidence, optional):
AGENTS.md: Compliant. Notices go through Prior reviews: None on this PR, so there were no earlier concerns to leave alone. Inline comments: None posted, since I found nothing that needs a change. Change sizeCompared with the base branch: the whole PR against main (merge base 36f1807 to PR head 4dafe4e).
|
📖 Docs preview
GitHub Pages takes a minute or two to publish a new commit. |
Summary
Pivot Table writes its statistics as decimals. A decimal holds whole numbers exactly only up to 2^53, so a
SUM,MAX,FIRST,MEDIAN(and so on) of larger Integer values came out rounded with no notice. Summary Statistics, Dissolve and Summarize Within already check each result (stats::rounded) and report it throughrounded_notice(#1253). Pivot Table calledstats::computedirectly and skipped the check.Now Pivot Table checks each cell the same way and gives the same notices:
N results rounded in y2020, y2021: a decimal field holds whole numbers exactly only up to 2^53 (9007199254740992), counted per pivot field over every row;N whole numbers written as text in v are past the 64-bit integer range and were read as decimals, …for a numeric value field holding such text, each record once.Without a statistic, values are placed with the value field's type, exactly, and get no notice.
Before, with
SUMofv, row fieldkand pivot fieldyon these records:the A cells come out 9007199254740994 and 9007199254740992, with only:
After:
Testing
cargo xtask ci.pivot_table_reports_rounded_cellsincrates/analysis/tests/summary_fields.rs, on layers read by the real GeoJSON reader:SUMandMAXgive the notice naming the pivot field;MAXof exactly 2^53,COUNTandCONCATENATEgive none;3 results rounded in y2020, y2021);UI evidence
No visible UI change.
Related issue
Same kind of loss as the summary fields in #1253; no separate issue.
Summary by CodeRabbit