Uh oh!
There was an error while loading. Please reload this page.
msgpack: support decimals with negative scale - #298
Merged
DifferentialOrange merged 2 commits intoJun 30, 2023
Conversation
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#314DifferentialOrangeforce-pushed
the
DifferentialOrange/decimal-negative-scale
branch
from
June 29, 2023 12:55
0767d7e to
086cdcaCompareDifferentialOrange
marked this pull request as ready for review
June 29, 2023 12:59
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.
Uh oh!
There was an error while loading. Please reload this page.
oleg-jukovec
approved these changes
Jun 30, 2023
oleg-jukovec
left a comment
Contributor
There was a problem hiding this comment.
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).
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 freeto 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 fixintscale and do not expectint 8[2],This patch fixes both of them. See also [3].