Add logic to generate a new snapshot-id#37
Merged
Fokko merged 3 commits intoapache:mainfrom Oct 5, 2023
Merged
Conversation
ad933c3 to
6fd84e2
Compare
6fd84e2 to
bfa8143
Compare
rdblue
reviewed
Oct 3, 2023
|
|
||
| Returns: An 64 bit long | ||
| """ | ||
| return uuid.uuid4().int & (1 << 64) - 1 |
Contributor
There was a problem hiding this comment.
Why not use the same approach as in Java, which will xor the most-significant int with the least-significant int and then make sure it's positive?
Contributor
Author
There was a problem hiding this comment.
Yes, this is actually not a great idea:
E Caused by: java.lang.IllegalArgumentException: Cannot parse to a long value: snapshot-id: 9330031330511797673
E at org.apache.iceberg.relocated.com.google.common.base.Preconditions.checkArgument(Preconditions.java:435)
E at org.apache.iceberg.util.JsonUtil.getLong(JsonUtil.java:135)
E at org.apache.iceberg.SnapshotParser.fromJson(SnapshotParser.java:116)
A >64 bit int
Contributor
Author
There was a problem hiding this comment.
It was because I read unsigned. Fixed that.
rdblue
approved these changes
Oct 3, 2023
Contributor
rdblue
left a comment
There was a problem hiding this comment.
Looks okay to me. I think this works but it isn't quite what we do in Java and I don't see why we'd change it.
Contributor
Author
|
In Python, you cannot xor on ints/longs (probably because they are also unbound in terms of size :), so I had to deviate a bit there. |
d0425b3 to
11b3c5d
Compare
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 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.
No description provided.