You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2021/04/23 07:16:06 UTC

[GitHub] [iceberg] findepi commented on a change in pull request #57: Use a UUID-based approach to generate snapshot ids

findepi commented on a change in pull request #57:
URL: https://github.com/apache/iceberg/pull/57#discussion_r618993169



##########
File path: core/src/main/java/com/netflix/iceberg/TableOperations.java
##########
@@ -73,6 +75,11 @@
    *
    * @return a long snapshot ID
    */
-  long newSnapshotId();
+  default long newSnapshotId() {
+    UUID uuid = UUID.randomUUID();
+    long mostSignificantBits = uuid.getMostSignificantBits();
+    long leastSignificantBits = uuid.getLeastSignificantBits();
+    return Math.abs(mostSignificantBits ^ leastSignificantBits);

Review comment:
       Is it worth commenting how is it superior over `Random.nextLong`?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org