-
Notifications
You must be signed in to change notification settings - Fork 46
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
msgpack: support decimals with negative scale #298
Merged
DifferentialOrange
merged 2 commits into
master
from
DifferentialOrange/decimal-negative-scale
Jun 30, 2023
Merged
msgpack: support decimals with negative scale #298
DifferentialOrange
merged 2 commits into
master
from
DifferentialOrange/decimal-negative-scale
Jun 30, 2023
Conversation
This file contains 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
Current decimal external type parser do not expect negative scale in decimal payload. Negative scale is a positive exponent. It seems that the only way to obtain positive exponent is to use E-notation since Tarantool library do not truncate trailing zeroes before decimal point: ``` tarantool> msgpack.encode(decimal.new('1e33')):hex() --- - c70301d0df1c ... tarantool> msgpack.encode(decimal.new('1000000000000000000000000000000000')):hex() --- - c713010001000000000000000000000000000000000c ... ``` There are two different bugs in current implementation: - we support only `positive fixint` scale and do not expect `int 8` [2], - we do not expect negative scale so positive exponent will be ignored. This patch fixes both of them. See also [3]. 1. https://github.com/tarantool/tarantool/blob/ba749e820bf0638aa3f79f266848590f9713c1cf/src/lib/core/decimal.c#L432-L450 2. https://github.com/msgpack/msgpack/blob/master/spec.md 3. tarantool/go-tarantool#314
DifferentialOrange
force-pushed
the
DifferentialOrange/decimal-negative-scale
branch
from
June 29, 2023 12:55
0767d7e
to
086cdca
Compare
msgpack-python package was deprecated in 2018 in favor of msgpack package. After previous patch in the patchset, we require `Unpacker` `tell` handle and msgpack-python 0.4.0 do not yet have it. It seems to be no reason to support the package which is not supported for the five years already, so we better drop it.
oleg-jukovec
approved these changes
Jun 30, 2023
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.
Thank you for the patch!
DifferentialOrange
added a commit
that referenced
this pull request
Jun 30, 2023
Overview This release inroduces API to request server protocol version and feature, as well as introduce decimal bugfix. Breaking changes - Drop `msgpack-python` support. (Package not supported since 2019.) Use `msgpack` instead. Added - Allow to require specific server protocol version and features (#267). Fixed - Parsing of E-notation Tarantool decimals with positive exponent (PR #298).
Merged
DifferentialOrange
added a commit
that referenced
this pull request
Jun 30, 2023
Overview This release introduces API to request server protocol version and feature, as well as introduce decimal bugfix. Breaking changes - Drop `msgpack-python` support. (Package not supported since 2019.) Use `msgpack` instead. Added - Allow to require specific server protocol version and features (#267). Fixed - Parsing of E-notation Tarantool decimals with positive exponent (PR #298).
DifferentialOrange
added a commit
that referenced
this pull request
Jun 30, 2023
Overview This release introduces API to request server protocol version and feature, as well as introduce decimal bugfix. Breaking changes - Drop `msgpack-python` support. (Package not supported since 2019.) Use `msgpack` instead. Added - Allow to require specific server protocol version and features (#267). Fixed - Parsing of E-notation Tarantool decimals with positive exponent (PR #298).
DifferentialOrange
added a commit
that referenced
this pull request
Jun 30, 2023
Overview This release introduces API to request server protocol version and feature, as well as introduce decimal bugfix. Breaking changes - Drop `msgpack-python` support. (Package not supported since 2019.) Use `msgpack` instead. Added - Allow to require specific server protocol version and features (#267). Fixed - Parsing of E-notation Tarantool decimals with positive exponent (PR #298).
DifferentialOrange
added a commit
that referenced
this pull request
Jun 30, 2023
Overview This release introduces API to request server protocol version and feature, as well as introduce decimal bugfix. Breaking changes - Drop `msgpack-python` support. (Package not supported since 2019.) Use `msgpack` instead. Added - Allow to require specific server protocol version and features (#267). Fixed - Parsing of E-notation Tarantool decimals with positive exponent (PR #298).
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.
Current decimal external type parser do not expect negative scale in decimal payload. Negative scale is a positive exponent. It seems that the only way to obtain positive exponent is to use E-notation since Tarantool library do not truncate trailing zeroes before decimal point:
There are two different bugs in current implementation:
positive fixint
scale and do not expectint 8
[2],This patch fixes both of them. See also [3].