-
Notifications
You must be signed in to change notification settings - Fork 19
Java type convertion for integer #11
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
Comments
I will fix this in next release. |
Thanks |
I've researched this problem. You could look at https://github.com/tarantool/tarantool-java/blob/master/src/main/java/org/tarantool/MsgPackLite.java from line 92. Msgpack stores number in smallest number type possible. |
So it should enough to save the value < MAX_UINT31 (equivalent to Integer.MAX_VALUE) as MP_INT32 instead of MP_UINT32,if I well understood the code. |
But if u store long with value = 1 u will read int :) it's a problem |
Ok, now I understood your point: you don't save (or better, you can't save) the original type so you can't restore it. Thanks, |
Raw idea: after #7 we can use space format to automatically retrieve results with appropriate types. |
It seems that the only working way to handle this flaw is to provide a ResultSet object to allow a user to acquire a value in a certain Java type with getInt() / getLong() / getString() getter. Implicit conversion should be performed when it is possible and there is no precision loss. Otherwise a runtime exception should be fired up. This way we also gracefully handle |
Connected with #92. |
Hi,
I see that when getting a tuple of integers the JAVA type is List of objects whose type is Integer if the value is < 65535 and a Long if the value is >= 65535, also if the Integer type can contains number until 2^31
This generate a weird behavior: I create a tuple of Integer and I get a mix of Integer and Long.
The text was updated successfully, but these errors were encountered: