Skip to content

expr: canonicalize round_numeric output to remove negative zero#36655

Merged
def- merged 1 commit into
MaterializeInc:mainfrom
def-:pr-munge-numeri
May 22, 2026
Merged

expr: canonicalize round_numeric output to remove negative zero#36655
def- merged 1 commit into
MaterializeInc:mainfrom
def-:pr-munge-numeri

Conversation

@def-
Copy link
Copy Markdown
Contributor

@def- def- commented May 21, 2026

dec::Context::round preserves the sign bit when a negative fractional value rounds to zero, producing -0 from e.g. round(-0.4). Numeric row encoding includes the sign bit, so the unmunged result diverges from 0 under bytewise row identity (DISTINCT, UNION, GROUP BY, joins) even though decimal = treats them as equal, and the text cast renders the value as -0.

Run munge_numeric after rounding, matching every other scale-changing op in this file.

`dec::Context::round` preserves the sign bit when a negative fractional
value rounds to zero, producing `-0` from e.g. `round(-0.4)`. Numeric
row encoding includes the sign bit, so the unmunged result diverges
from `0` under bytewise row identity (DISTINCT, UNION, GROUP BY, joins)
even though decimal `=` treats them as equal, and the text cast renders
the value as `-0`.

Run `munge_numeric` after rounding, matching every other scale-changing
op in this file.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@def- def- requested a review from antiguru May 21, 2026 02:24
@def- def- requested a review from a team as a code owner May 21, 2026 02:24
@def- def- merged commit 0a5fe19 into MaterializeInc:main May 22, 2026
118 checks passed
@def- def- deleted the pr-munge-numeri branch May 22, 2026 00:35
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