-
Notifications
You must be signed in to change notification settings - Fork 1.6k
fix(query): return full float value in query results #9492
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Thank you for reviewing. Just a note that I've got |
|
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.
Head branch was pushed to by a user without write access
|
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. |
|
Sorry about the bumpy road, and thank you for reviewing! |
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