Skip to content

fix(console) fixing formating of numerics into strings - #6270

Closed
sachalau wants to merge 1 commit into
SQLMesh:mainfrom
sachalau:fix/numeric-formatting
Closed

sachalau wants to merge 1 commit into
SQLMesh:mainfrom
sachalau:fix/numeric-formatting

Conversation

@sachalau

@sachalau sachalau commented Nov 26, 2026 •

Copy link
Copy Markdown

Description

While debugging we (claude + me) were extremely confused by the discrepancy between number of rows reported for a model by the SQLMesh console log and the actual number of rows.

It (Claude) finally understood that a trivial bug on formatting had transformed 5.01 M rows into 51 M rows.

We switched the formatting to using regexp instead of replace.

Test Plan

Tests added. Another file was modified locally because of the make style but I didn't include it in the PR because it was irrelevant to it.

Checklist

  • I have run make style and fixed any issues
  • I have added tests for my changes (if applicable)
  • All existing tests pass (make fast-test)
  • My commits are signed off (git commit -s) per the DCO

Thanks a lot to the whole team for such a useful tool !

Summary by CodeRabbit

  • Bug Fixes
    • Improved processed-row counts in evaluation summaries. Counts now use singular or plural “row” labels appropriately and display large values with compact suffixes and consistent rounding. Trailing decimal zeros are removed without changing other decimal values, making the summaries clearer and more accurate.

@sachalau sachalau changed the title fixing formating of numerics into strings fix(console) fixing formating of numerics into strings Nov 26, 2026
@coderabbitai

coderabbitai Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The evaluation annotation formatter now removes trailing decimal zeros only at the end of a metric value or before a space. Parameterized tests cover row-count wording and compact formatting from 1 to 2.07 billion.

Changes: Evaluation annotation formatting

Layer / File(s) Summary
Format and test row metrics
sqlmesh/core/console.py, tests/core/test_console.py
The formatter trims trailing decimal zeros only before a space or at the end of the string. Tests cover singular and plural row wording and compact k, M, and G formats.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix · Severity of issue fixed: Low

Suggested reviewers: treysp, erindru

Merge Risk: Minimal · up to 6c345

This change fixes console row-count formatting so that values such as 5.01 million are no longer shown as 51 million. The change is small and tested, and no merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "fix(console) fixing formating of numerics into strings" names the primary change: a fix in console numeric-to-string formatting. The changeset replaces the chained replace calls in create…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The description explains the problem and the fix. The author reports that a formatting bug turned 5.01 M rows into 51 M rows, and that the formatting moved from replace to a regular expression. The au…
Full details: Title check

Explanation

The title "fix(console) fixing formating of numerics into strings" names the primary change: a fix in console numeric-to-string formatting. The changeset replaces the chained replace calls in _create_evaluation_model_annotation with a regex that removes trailing zero decimals from metric(rows_processed). The title has a typo ("formating") and omits the specific bug (5.01 M rows shown as 51 M), but it is related to the main change. It is not vague.

Full details: Description check

Explanation

The description explains the problem and the fix. The author reports that a formatting bug turned 5.01 M rows into 51 M rows, and that the formatting moved from replace to a regular expression. The author also reports that tests were added, that make style was run, and that the DCO sign-off box is checked. The description follows the required template headings (Description, Test Plan, Checklist). Two parts are thin. The Test Plan says only "Tests added" and does not name the test cases or the row-count values checked. The Description also does not name the function changed, so a reviewer must read the diff to find it.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 55ea1036-bdce-4a05-bfe5-a57fa4c17dce
Commits

Reviewing files that changed from the base of the PR and between ce229ae and 6c34534.

Files selected for processing: 2

  • sqlmesh/core/console.py
  • tests/core/test_console.py

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

@sachalau sachalau closed this Nov 26, 2026
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.

1 participant