Skip to content

fix(histogram): bound exact-bin SQL growth - #1544

Merged
kentwelcome merged 1 commit into
feature/drc-4216-legacy-histogram-restore-datetimestamp-rendering-for-savedfrom
feature/drc-4232-histogram-bound-exact-bin-sql-growth-with-adapter-specific
Sep 4, 2026
Merged

kentwelcome merged 1 commit into
feature/drc-4216-legacy-histogram-restore-datetimestamp-rendering-for-savedfrom
feature/drc-4232-histogram-bound-exact-bin-sql-growth-with-adapter-specific

Conversation

@gcko

@gcko gcko commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

PR checklist

  • Ensure you have added or ran the appropriate tests for your PR.
  • DCO signed

What type of PR is this?

Bugfix

What this PR does / why we need it:

  • Adds bounded-size exact histogram SQL for runtime-proven DuckDB integral and fixed-DECIMAL columns.
  • Uses scaled HUGEINT arithmetic with mathematical negative floor division and explicit terminal-maximum ownership.
  • Requires identical authoritative base/current physical types before compacting, so mixed or stale metadata falls back safely.
  • Keeps the exact literal comparison ladder for floats, unknown adapters/types, and every precision or overflow risk.
  • Emits best-effort strategy/bin-count/SQL-length telemetry without affecting successful runs.
  • Preserves the existing unbounded num_bins contract across direct, saved, and MCP requests.

Which issue(s) this PR fixes:

Closes DRC-4232

Special notes for your reviewer:

  • Stack position: 3 of 3 in the histogram stack.
  • Base/parent: feature/drc-4216-legacy-histogram-restore-datetimestamp-rendering-for-saved
  • Parent PR: fix(histogram): restore temporal execution and rendering #1543
  • GitHub stack: https://github.com/DataRecce/recce/stacks/1545
  • Focused histogram/adapter/MCP suite: 240 passed; focused API/check/run suite: 60 passed.
  • Full Python suite: 2,008 passed, 5 skipped.
  • Full frontend suite at the final stack head: 4,414 passed, 5 skipped.
  • make test-tox passed dbt 1.6, 1.7, 1.8, 1.9, and latest.
  • OSS production build, repository flake8, pinned formatting/lint hooks, and diff checks passed.
  • Adversarial regressions cover 37-digit Decimal context safety plus mixed and stale physical column types.

Does this PR introduce a user-facing change?:

Yes.

Large DuckDB histogram requests now use compact exact bucketing SQL while preserving existing request compatibility and safe fallbacks.

@gcko gcko self-assigned this Sep 4, 2026
@gcko
gcko requested a review from kentwelcome September 4, 2026 08:30
@codecov

codecov Bot commented Sep 4, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.55035% with 19 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
recce/adapter/histogram_bucketing.py 90.90% 11 Missing ⚠️
tests/tasks/test_histogram.py 97.31% 5 Missing ⚠️
recce/tasks/histogram.py 95.16% 3 Missing ⚠️
Files with missing lines Coverage Δ
tests/adapter/test_histogram_bucketing.py 100.00% <100.00%> (ø)
tests/test_mcp_server.py 99.89% <100.00%> (+<0.01%) ⬆️
recce/tasks/histogram.py 91.29% <95.16%> (+0.32%) ⬆️
tests/tasks/test_histogram.py 98.77% <97.31%> (-0.90%) ⬇️
recce/adapter/histogram_bucketing.py 90.90% <90.90%> (ø)

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@kentwelcome kentwelcome left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

DRC-4232

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Jared Scott <jared.scott@datarecce.io>
@kentwelcome
kentwelcome force-pushed the feature/drc-4232-histogram-bound-exact-bin-sql-growth-with-adapter-specific branch from 93de724 to 3edde0b Compare September 4, 2026 09:15
@kentwelcome
kentwelcome merged commit 31e2d9e into main Sep 4, 2026
20 of 22 checks passed
@kentwelcome
kentwelcome deleted the feature/drc-4232-histogram-bound-exact-bin-sql-growth-with-adapter-specific branch September 4, 2026 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants