twalthr commented on code in PR #29154:
URL: https://github.com/apache/flink/pull/29154#discussion_r4003359150
##########
docs/data/sql_functions.yml:
##########
@@ -227,7 +227,13 @@ arithmetic:
description: Returns a pseudorandom integer value in the range [0, INT2)
with an initial seed INT1. Two RAND_INTEGER functions will return identical
sequences of numbers if they have the same initial seed and bound.
- sql: UUID()
table: uuid()
- description: Returns an UUID (Universally Unique Identifier) string (e.g.,
"3d3c68f7-f608-473f-b60c-b0c44ad4cc4e") according to RFC 4122 type 4 (pseudo
randomly generated) UUID. The UUID is generated using a cryptographically
strong pseudo random number generator.
+ description: Returns an UUID (Universally Unique Identifier) string (e.g.,
"3d3c68f7-f608-473f-b60c-b0c44ad4cc4e") according to RFC 9562 version 4 (pseudo
randomly generated) UUID. The UUID is generated using a cryptographically
strong pseudo random number generator.
+ - sql: UUID_V4()
+ table: uuidV4()
+ description: Returns a random RFC 9562 version 4 UUID value. The UUID is
generated using a cryptographically strong pseudo random number generator.
Review Comment:
Add "Compared to UUID, this function returns a value of UUID data type."
##########
docs/data/sql_functions.yml:
##########
@@ -227,7 +227,13 @@ arithmetic:
description: Returns a pseudorandom integer value in the range [0, INT2)
with an initial seed INT1. Two RAND_INTEGER functions will return identical
sequences of numbers if they have the same initial seed and bound.
- sql: UUID()
table: uuid()
- description: Returns an UUID (Universally Unique Identifier) string (e.g.,
"3d3c68f7-f608-473f-b60c-b0c44ad4cc4e") according to RFC 4122 type 4 (pseudo
randomly generated) UUID. The UUID is generated using a cryptographically
strong pseudo random number generator.
+ description: Returns an UUID (Universally Unique Identifier) string (e.g.,
"3d3c68f7-f608-473f-b60c-b0c44ad4cc4e") according to RFC 9562 version 4 (pseudo
randomly generated) UUID. The UUID is generated using a cryptographically
strong pseudo random number generator.
+ - sql: UUID_V4()
+ table: uuidV4()
+ description: Returns a random RFC 9562 version 4 UUID value. The UUID is
generated using a cryptographically strong pseudo random number generator.
Review Comment:
Add this to all JavaDocs etc.
##########
flink-table/flink-table-runtime/src/main/java/org/apache/flink/table/runtime/functions/UuidGenerationUtils.java:
##########
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.table.runtime.functions;
+
+import org.apache.flink.annotation.Internal;
+import org.apache.flink.table.types.logical.UuidType;
+
+import java.nio.ByteBuffer;
+import java.security.SecureRandom;
+import java.util.UUID;
+
+/**
+ * Runtime helpers for generating {@code UUID} values, stored as their 16-byte
big-endian encoding.
+ */
+@Internal
+public final class UuidGenerationUtils {
Review Comment:
I agree. Let's move the methods to the corresponding functions and drop the
`UuidGenerationUtils` class.
##########
docs/data/sql_functions_zh.yml:
##########
@@ -280,8 +280,16 @@ arithmetic:
- sql: UUID()
table: uuid()
description: |
- 根据 RFC 4122 类型 4(伪随机生成)UUID,返回 UUID(通用唯一标识符)字符串。
+ 根据 RFC 9562 类型 4(伪随机生成)UUID,返回 UUID(通用唯一标识符)字符串。
Review Comment:
Only add english text here. English speakers cannot review/approve otherwise.
--
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]