Fokko commented on code in PR #37:
URL: https://github.com/apache/iceberg-python/pull/37#discussion_r1344387785
##########
pyiceberg/table/__init__.py:
##########
@@ -1566,3 +1575,15 @@ def _add_and_move_fields(
elif len(moves) > 0:
return _move_fields(fields, moves)
return None if len(adds) == 0 else tuple(*fields, *adds)
+
+
+def _generate_snapshot_id() -> int:
+ """Generate a new Snapshot ID from a UUID.
+
+ Right shifting the 64 bits removes the MAC address and time
+ leaving only the part that's based on the clock (and has the
+ highest entropy).
+
+ Returns: An 64 bit long
+ """
+ return uuid.uuid4().int & (1 << 64) - 1
Review 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 128 bit int
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]