Skip to content
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

int32 в индексе #48

Closed
ZUBAT opened this issue Mar 25, 2019 · 3 comments · Fixed by #53
Closed

int32 в индексе #48

ZUBAT opened this issue Mar 25, 2019 · 3 comments · Fixed by #53

Comments

@ZUBAT
Copy link

ZUBAT commented Mar 25, 2019

tarantool.select(spaceId: Number or String, indexId: Number or String, limit: Number, offset: Number, iterator: Iterator, key: tuple)
ключ для индекса не позволяет выполнить поиск по значению больше чем int32
connection.select('chat', 'primary', 20, 0, 'lt', [2147483648])

UnhandledPromiseRejectionWarning: TarantoolError: Supplied key type of part 0 does not match index part type: expected unsigned
connection.select('chat', 'primary', 20, 0, 'lt', [2147483647]) - работает нормально

@1aerostorm
Copy link

1aerostorm commented Aug 19, 2021

Тоже столкнулся. Да и не только в select. Такая же проблема и в insert. Да, жесткий баг. К примеру, хранить timestamp в миллисекундах не получится из-за него.

Work-around: завернуть в хранимку (вот call нормально работает). Или просто юзать string...

@sergos
Copy link
Contributor

sergos commented Jun 7, 2024

The reason is msgpack considers the value as a double if it doesn't fit:

> a=[21474836470]
[ 21474836470 ]
> typeof(a[0])
'number'
> msgpack.encode(a)
<Buffer 91 cb 42 13 ff ff ff d8 00 00>

Where 0xcb means float 64.

@goodwise
Copy link
Contributor

goodwise commented Jun 22, 2024

In progress at #53 , will be fixed by using packInteger() method, which forces msgpack-lite to safely encode a number.

If value doesn't fit as int32, it will be packed as int64 rather than float 64.

@sergos sergos closed this as completed in #53 Sep 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants