huaxingao commented on code in PR #14700:
URL: https://github.com/apache/iceberg/pull/14700#discussion_r2572398708


##########
core/src/main/java/org/apache/iceberg/rest/RESTUtil.java:
##########
@@ -271,4 +273,25 @@ public static String resolveEndpoint(String catalogUri, 
String endpointPath) {
   public static Map<String, String> configHeaders(Map<String, String> 
properties) {
     return RESTUtil.extractPrefixMap(properties, "header.");
   }
+
+  /**
+   * Generate a RFC 9562 UUIDv7 string.
+   *
+   * <p>Layout: - 48-bit Unix epoch milliseconds - 4-bit version (0b0111) - 
12-bit random (rand_a) -
+   * 2-bit variant (RFC 4122, 0b10) - 62-bit random (rand_b)
+   */
+  public static String generateUuidV7() {
+    long epochMs = System.currentTimeMillis() & 0xFFFFFFFFFFFFL; // 48 bits

Review Comment:
   I compared with JDK 26’s `UUID.ofEpochMillis` and our layout matches (48‑bit 
timestamp, version 7 nibble, RFC 4122 variant, 12+62 random bits). I’d like to 
keep a no‑arg `generateUuidV7()` to mirror `UUID.randomUUID()` and avoid 
exposing timestamps; since callers need a header value, it returns String. I’ll 
align by using `SecureRandom` and adding a 48‑bit range check. I won’t copy JDK 
code (licensing), but the behavior is equivalent. The test is also the same: 
verify `version() == 7` and `variant()==2`.



-- 
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]

Reply via email to