Repository navigation
guard data viewer histogram computation against hist() failures - #17991
Merged
Merged
Conversation
…gnitudes Whole-number double columns at very large magnitudes (abs value >= ~2^52) within a narrow range trip the integer-breaks heuristic, but seq() collapses to a single value at that floating-point resolution. hist() then treats the lone break as a scalar bin count, erroring with "invalid number of 'breaks'" for negative values. Drop the collapsed breaks and fall back to default binning. Adds a regression test. Addresses #17990
🍎 macOS Desktop E2E · ARM64❌ 3 test(s) failed
📥 Download Playwright report⬇️ playwright-report.zip — extract and open
2 shards · macos-26 ARM64 · commit |
🪟 Windows Desktop E2E · Server 2025 x64✅ All tests passed!
📥 Download Playwright report⬇️ playwright-report.zip — extract and open
2 shards · Windows Server 2025 x64 · commit |
3 of 4 tasks
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.
When opening a data frame in the data viewer, RStudio computes a histogram for each numeric column (via
hist()in.rs.describeCols(),SessionDataViewer.R) to power the column sparkline and brushing filter.There are two related problems, both surfacing as
hist.default()raisingstop("invalid number of 'breaks'")(and otherstop()paths):No error guard. The histogram branch only wrapped the call in
suppressWarnings(), which does not catch errors, so anyhist()failure propagated and aborted the entiredescribecall -- breaking the whole data viewer rather than just the offending column.Collapsed integer breaks. For whole-number columns spanning a small range we build
int_breaks <- seq(min - 0.5, max + 0.5, by = 1)to draw one bar per integer. At very large magnitudes (abs value >= ~2^52, reachable since Title: Data viewer fails with "missing value where TRUE/FALSE needed" on integer columns whose range exceeds .Machine$integer.max #17951 coerces integer columns to double) the unit step and 0.5 offsets fall below the floating-point resolution and the sequence collapses to a single value.hist()then treats that lone break as a scalar bin count -- which errors for large negative values (count < 1) and is meaningless for positive ones.This wraps the histogram computation in
.rs.tryCatch()(matching the sibling factor / character-summary branches: on failure the column's histogram fields are cleared and the error is logged), and drops the integer breaks when they collapse so we fall back to default binning. Includes a regression test for the large-magnitude case.Reported (without a reproducible example) at https://forum.posit.co/t/new-histograms-in-golden-wattle-data-viewer-break/212784
Fixes #17990.