Repository navigation
A Trino decimal reads as a number, so SUM(amount) is 1234.5 instead of "1234.50" - #1414
Merged
Merged
Conversation
…f "1234.50" Signed-off-by: Rudy Celekli <rudy@gradiahq.com>
WaylandYang
requested changes
Oct 25, 2026
WaylandYang
left a comment
Contributor
There was a problem hiding this comment.
Correct. Please add Trino decimals to ADR 0018's fourth-gate paragraph. We'll merge this after #1413 so long decimals keep their digits.
Signed-off-by: Rudy Celekli <rudy@gradiahq.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
WaylandYang
approved these changes
Oct 27, 2026
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.
Why
Trino's client protocol writes most numbers as JSON numbers, but it writes
decimalas a string. InJsonEncodingUtils, aSqlDecimalgoes throughgenerator.writeString(decimalValue.toString())(source). The Trino engine passeddatathrough untouched. A money column, or anySUM/AVGover one, reached the model as"1234.50", whileCOUNT(*)in the same row was the number7.The other HTTP engines already restore these values by column type: Databricks and Snowflake through
coerce, ClickHouse through itscell. As thecoercecomment notes, the model does arithmetic differently on"42"and42. A Trino, Starburst, Iceberg or Hive catalog was the one place where amounts stayed quoted.What changes
Columnnow also reads thetypeeach column already carries. After the pages are collected, cells in adecimal(p,s)column go throughcoerce("DECIMAL", …), the same conversion Databricks and Snowflake decimals get. Nulls stay null, and other types are untouched.How it was checked
a_decimal_reads_as_a_number, returnsvarchar(5),decimal(12,2)andbigintcolumns, including a null decimal. It expects{"region":"east","total":1234.5,"orders":7}.cargo test -p utopia-server --bins query_engine: 73 passed.left: ["{\"region\":\"east\",\"total\":\"1234.50\",\"orders\":7}", …].cargo fmt --all --checkandcargo clippy -p utopia-server --all-targets -- -D warningspass.Before review
git commit -s)cargo fmt --all --check,cargo clippyandcargo testpass for the touched crateRequested ADR follow-up
Updated ADR 0018 as requested in review. This appended revision changes documentation only; Rust and Cargo files are byte-for-byte unchanged from the prior public head.
cargo fmt --all --checkandgit diff --checkpass. No new Rust test run or live-cluster acceptance is claimed for this revision. Final-head CI remains required.Merge after #1413, as requested; the ADR retains that exact-value dependency.