-
Notifications
You must be signed in to change notification settings - Fork 72
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
[API-703] v5 SQL: Add default serializers for the new types #459
Conversation
f64a29d
to
9b4e588
Compare
Codecov Report
@@ Coverage Diff @@
## master #459 +/- ##
==========================================
- Coverage 94.47% 94.10% -0.37%
==========================================
Files 345 345
Lines 17563 17626 +63
==========================================
- Hits 16592 16587 -5
- Misses 971 1039 +68
Continue to review full report at Codecov.
|
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.
Looks good with minors
|
||
def int_to_bytes(number): | ||
# number of bytes to represent the number | ||
width = (8 + (number + (number < 0)).bit_length()) // 8 |
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.
this is hard to understand. I understood the logic but in a quite long time. Maybe add a link to website if you take it from somewhere or else, explain it a bit?
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.
See 9485b4a
_CONVERSION_TEST_CASES = [ | ||
(0, [0]), | ||
(-1, [255]), | ||
(127, [127]), | ||
(-128, [128]), | ||
(999, [3, 231]), | ||
(-123456, [254, 29, 192]), | ||
(2147483647, [127, 255, 255, 255]), | ||
(-2147483648, [128, 0, 0, 0]), | ||
(9223372036854775807, [127, 255, 255, 255, 255, 255, 255, 255]), | ||
(-9223372036854775808, [128, 0, 0, 0, 0, 0, 0, 0]), | ||
# fmt: off | ||
( | ||
23154266667777888899991234566543219999888877776666245132, | ||
[0, 241, 189, 232, 38, 131, 251, 137, 60, 34, 23, 53, 163, 116, 208, 85, 14, 65, 40, 174, 120, 10, 56, 12] | ||
), | ||
( | ||
-23154266667777888899991234566543219999888877776666245132, | ||
[255, 14, 66, 23, 217, 124, 4, 118, 195, 221, 232, 202, 92, 139, 47, 170, 241, 190, 215, 81, 135, 245, 199, 244] |
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.
Where did you get these(online or via python interpreter etc.)? Just curious..
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.
I tried different values with Java's BigInteger
@@ -7,6 +7,7 @@ However, we had to edit ``ReferenceObjects`` while generating the file because t | |||
such serializers for the Python client yet. The list of skipped items from ``ReferenceObjects`` | |||
are shown below. | |||
|
|||
* aDate |
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.
Maybe we can add a note about this that it was removed due to introducing OffsetDateTime.
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.
This is really an internal thing so I don't think it is necessary. I will put a note about the removal of java.util.Date support in the 5.0 release notes
inp.read_int(), | ||
inp.read_byte(), | ||
inp.read_byte(), |
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.
Are we sure that these will run in this order? (I mean across python versions etc., just to be sure)
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.
If they do that, that would break the public API. So, I don't think it will happen at all.
(-2147483648, [128, 0, 0, 0]), | ||
(9223372036854775807, [127, 255, 255, 255, 255, 255, 255, 255]), | ||
(-9223372036854775808, [128, 0, 0, 0, 0, 0, 0, 0]), | ||
# fmt: off |
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.
What does this mean?
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.
It is to disable black's autoformatting. It formats this long list one item per line, which does not look good. So, we disable black for this small region
This PR adds support for the new default types, namely - LocalDate -> datetime.date - LocalTime -> datetime.time - OffsetDateTime -> datetime.datetime - LocalDateTime (only deserializing it to datetime.datetime) - BigDecimal -> decimal.Decimal It also fixes the issues on reading/writing big integer objects. Also, this PR updates the serialization tests with the new types (+ sum types that are not added before to tests such as aggregators, projections, ...)
3c53cb2
to
3d221bb
Compare
This PR adds support for the new default types, namely
It also fixes the issues on reading/writing big integer objects.
Also, this PR updates the serialization tests with the new types
(+ sum types that are not added before to tests such as aggregators,
projections, ...)