-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
tree: fix decimal strings for 0 with exponents < -6 #102299
Conversation
@otan thanks for picking this up! are there any risks here, or should we just go for this approach? |
i'm fine with it if you are ;) |
(but we'll want to merge cockroachdb/apd#128 first) |
0d8cfab
to
87c279f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this fix #102217 or are there more cases to deal with?
i'm surprised the ::decimal
cases in pkg/cmd/generate-binary/main.go weren't affected. could we add a a test there that shows the fix in action?
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @otan)
pkg/sql/logictest/testdata/logic_test/decimal
line 480 at r1 (raw file):
0 -1 -0 0 -0 0 4.2 0E+1 0.0 0 0 Infinity 0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0 0
i tried this query on postgres and got this result for this row:
0 | Infinity | 0 | 0 | 0
Release note (bug fix): Fix a bug where 0 with exponents < -6 would display as 0E(exponent) instead of printing all 0s, e.g. 0E-7 should be 0.0000000.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this fix #102217 or are there more cases to deal with?
this fixes the display issue, yeah
i'm surprised the
::decimal
cases in pkg/cmd/generate-binary/main.go weren't affected. could we add a a test there that shows the fix in action?
yep
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @rafiss)
pkg/sql/logictest/testdata/logic_test/decimal
line 480 at r1 (raw file):
Previously, rafiss (Rafi Shamim) wrote…
i tried this query on postgres and got this result for this row:
0 | Infinity | 0 | 0 | 0
this is a bug in our implementation more than anything, and is unrelated to this PR.
pg:
otan=# select 0::decimal / 'infinity'::decimal;
?column?
----------
0
(1 row)
crdb, before this pr:
root@:26257/defaultdb> select 0::decimal / 'infinity'::decimal;
?column?
------------
0E-2019
(1 row)
i'm guessing our use of HighPrecisionContext
to divide Infinity
is incorrect (it's also incorrect for all the other cases). Seems outside the scope of what I need out of this PR though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @otan)
pkg/sql/logictest/testdata/logic_test/decimal
line 480 at r1 (raw file):
Previously, otan (Oliver Tan) wrote…
this is a bug in our implementation more than anything, and is unrelated to this PR.
pg:
otan=# select 0::decimal / 'infinity'::decimal; ?column? ---------- 0 (1 row)
crdb, before this pr:
root@:26257/defaultdb> select 0::decimal / 'infinity'::decimal; ?column? ------------ 0E-2019 (1 row)
i'm guessing our use of
HighPrecisionContext
to divideInfinity
is incorrect (it's also incorrect for all the other cases). Seems outside the scope of what I need out of this PR though.
hm ok - but do you have a sense of what is needed in apd
to make 0.00000...0
display as 0
? would be nice to address later
Previously, rafiss (Rafi Shamim) wrote…
it's not |
Previously, otan (Oliver Tan) wrote…
(we need to change the builtin or whatever that does this) |
bors r=rafiss |
filed #102299 |
Previously, otan (Oliver Tan) wrote…
actually it may be |
Build succeeded: |
Encountered an error creating backports. Some common things that can go wrong:
You might need to create your backport manually using the backport tool. error setting reviewers, but backport branch blathers/backport-release-23.1-102299 is ready: POST https://api.github.com/repos/cockroachdb/cockroach/pulls/103640/requested_reviewers: 422 Reviews may only be requested from collaborators. One or more of the teams you specified is not a collaborator of the cockroachdb/cockroach repository. [] Backport to branch 23.1.x failed. See errors above. 🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf. |
This patch fixes the default numbers test to expect the correct result after cockroachdb/cockroach#102299 was merged.
This patch fixes the default numbers test to expect the correct result after cockroachdb/cockroach#102299 was merged.
This patch fixes the default numbers test to expect the correct result after cockroachdb/cockroach#102299 was merged.
This patch fixes the default numbers test to expect the correct result after cockroachdb/cockroach#102299 was merged.
This patch fixes the default numbers test to expect the correct result after cockroachdb/cockroach#102299 was merged.
Release note (bug fix): Fix a bug where 0 with exponents < -6 would display
as
0E(exponent)
instead of printing all 0s, e.g.0E-7
should be0.0000000
.Informs #102217