fix(query): return full float value in query results#9492
Merged
matthewmcneely merged 7 commits intodgraph-io:mainfrom Aug 26, 2025
Merged
fix(query): return full float value in query results#9492matthewmcneely merged 7 commits intodgraph-io:mainfrom
matthewmcneely merged 7 commits intodgraph-io:mainfrom
Conversation
mangalaman93
approved these changes
Aug 20, 2025
mangalaman93
approved these changes
Aug 21, 2025
Contributor
Author
|
Thank you for reviewing. Just a note that I've got |
Contributor
Contributor
Author
|
Thank you! I'm just aiming to get tests passing for this PR, I see there are JSON comparisons scattered around that expect the old float format. Faster testing will be a nice improvement. |
9ceaf3e to
fd17b93
Compare
Updates JSON comparisons to recognize full float format.
auto-merge was automatically disabled
August 26, 2025 04:59
Head branch was pushed to by a user without write access
Contributor
Author
|
Some tests are giving Docker errors I don't understand, but they seem to have no float comparisons in them. I think all the relevant tests are passing now. |
Contributor
Author
|
Sorry about the bumpy road, and thank you for reviewing! |
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.
Description
Updates
floatformatting to express full values. Switches from%fto%g, which according to Golang docs will use as many digits as necessary to express the value.I had trouble getting
tto run. A new unit test passes with:go test github.com/hypermodeinc/dgraph/v25/queryCloses #9491.
Discussion
This changes the output format but not semantics of float values in result data. Currently floats have a fixed precision of 6, filled with trailing zeros as necessary.
{ "float": 1.000000 }The new specifier
%gdrops unnecessary trailing zeros.{ "float": 1 }I think this OK as they are semantically equivalent. Since unnecessary characters are dropped, it also saves bytes on the wire. It also aligns with the
bigfloatformat, which never gives trailing zeros.Checklist
CHANGELOG.mdfile describing and linking to this PR