Repository navigation
fix: support non-finite floats in complex results - #574
Merged
Merged
Conversation
Quote non-finite FLOAT and DOUBLE leaves in the shared JSON formatter instead of aborting row iteration. Preserve finite formatting, SQL NULL, top-level numeric types, and existing kernel MAP-key spellings. Add cross-backend regression coverage and document the encoding. Signed-off-by: Cathleen Yan <[email protected]> Co-authored-by: Isaac <[email protected]>
vuanhphung
reviewed
Nov 18, 2026
Render non-finite floating-point MAP keys as "NaN", "Infinity", and "-Infinity", the same strings used for values, instead of keeping the kernel backend's "+Inf"/"-Inf" key spellings. Document the kernel key change as a behavior change. Drop NaN from the scalar benchmark, where encoding/json takes an error path. Signed-off-by: Cathleen Yan <[email protected]> Co-authored-by: Isaac <[email protected]>
vuanhphung
approved these changes
Nov 19, 2026
vuanhphung
left a comment
Collaborator
There was a problem hiding this comment.
FYI on cross-connector consistency: the kernel's own complex_types_as_json renderer (used by Python's kernel backend) emits null for nested NaN/±Inf values (json.rs append_float), though it already uses "NaN"/"Infinity"/"-Infinity" for map keys. I think the Go choice is the right one, since it's valid JSON and keeps NULL distinct. I'll file a kernel follow-up to align it. No change needed here.
jsonfmt.Append no longer fails on floats, so the fmt "%v" fallback in writeJSONKey was unreachable for every key scalarForJSON returns. It was also the only source of the old "+Inf" spelling. Return the error instead, as the Thrift mapValueContainer does. Fix the stale marshalScalar comment and list non-finite floats in the package rendering rules. Co-authored-by: Isaac <[email protected]> Signed-off-by: Cathleen Yan <[email protected]>
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.
Summary
Fixes #573.
Valid SQL FLOAT and DOUBLE values containing NaN or infinities currently abort row iteration when nested inside ARRAY, MAP, or STRUCT results. The Go renderers serialize scalar leaves through
encoding/json, which rejects non-finite floats.Render these leaves as the JSON strings
"NaN","Infinity", and"-Infinity"in the shared formatter used by both Thrift and kernel-backed results. Keep SQL NULL asnullrather than losing the distinction between special floats and missing values.Compatibility
"NaN","Infinity", and"-Infinity"spellings as values on both backends. On the kernel backend, keys previously rendered as"+Inf"/"-Inf"now render as"Infinity"/"-Infinity";"NaN"is unchanged. On Thrift, these keys previously failed row iteration. Recorded in the changelog.anyor a custom decoder rather than plain float fields; this is documented in README and package docs.Test Plan
CGO_ENABLED=0 go test ./... -count=1passed with live warehouse credentials removed from the test environment.CGO_ENABLED=1 go test -race ./internal/jsonfmt ./internal/arrowscan ./internal/rows/arrowbased -count=1passed.CGO_ENABLED=0 go vet ./...passed.make lintpassed with zero issues.No live warehouse tests or native-kernel-linked E2E tests were run. Both Go renderers are exercised directly with in-memory Arrow arrays.
This pull request and its description were written by Isaac.