twalthr commented on code in PR #29087:
URL: https://github.com/apache/flink/pull/29087#discussion_r3925479631
##########
flink-core/src/main/java/org/apache/flink/api/common/typeinfo/BasicTypeInfo.java:
##########
@@ -338,5 +344,9 @@ private static <X> TypeComparator<X> instantiateComparator(
TYPES.put(BigInteger.class, BIG_INT_TYPE_INFO);
TYPES.put(BigDecimal.class, BIG_DEC_TYPE_INFO);
TYPES.put(Instant.class, INSTANT_TYPE_INFO);
+ // UUID is intentionally not registered here. Automatic reflective
extraction of
+ // java.util.UUID to UUID_TYPE_INFO in the DataStream API stays opt-in
via Types.UUID to
+ // avoid silently changing the serializer of existing java.util.UUID
fields (currently
+ // handled by Kryo). This is planned to change in the next major Flink
version.
Review Comment:
Please open a ticket for this with Fixed Version 3.0
##########
flink-core/src/main/java/org/apache/flink/api/common/typeinfo/Types.java:
##########
@@ -158,6 +159,9 @@ public class Types {
/** Returns type information for {@link java.time.Instant}. Supports a
null value. */
public static final TypeInformation<Instant> INSTANT =
BasicTypeInfo.INSTANT_TYPE_INFO;
+ /** Returns type information for {@link java.util.UUID}. Supports a null
value. */
Review Comment:
```suggestion
/** Returns type information for {@link java.util.UUID}. */
```
the serializer code says:
> so there is no reserved value for {@code null}; nullability is handled by
wrapping serializers
##########
flink-table/flink-table-common/src/test/java/org/apache/flink/table/types/extraction/DataTypeExtractorTest.java:
##########
@@ -81,6 +81,10 @@ private static Stream<TestSpec> testData() {
// simple extraction of BYTES
TestSpec.forType(byte[].class).expectDataType(DataTypes.BYTES()),
+ // automatic extraction of UUID for Table/SQL (DataStream
stays opt-in via
+ // Types.UUID)
Review Comment:
unrelated comment here
```suggestion
// automatic extraction of UUID for Table/SQL
```
##########
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/runtime/stream/sql/UuidITCase.java:
##########
@@ -0,0 +1,102 @@
+/*
+ * 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.planner.runtime.stream.sql;
+
+import org.apache.flink.table.api.EnvironmentSettings;
+import org.apache.flink.table.api.TableEnvironment;
+import org.apache.flink.table.api.ValidationException;
+import org.apache.flink.types.Row;
+import org.apache.flink.util.CloseableIterator;
+
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import java.util.stream.Stream;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.junit.jupiter.params.provider.Arguments.of;
+
+/** Runtime tests for the {@code UUID} type through the full
plan/codegen/execution stack. */
+class UuidITCase {
Review Comment:
Never just implement plain ITCases, usually they should extend from a test
base. Otherwise a full Flink local cluster is being used instead of performant
testing clusters. I would suggest to use SemanticTestBase here or
BuiltInFunctionTestBase?
##########
flink-table/flink-table-type-utils/src/main/java/org/apache/flink/table/data/conversion/DataStructureConverters.java:
##########
@@ -197,6 +198,7 @@ public final class DataStructureConverters {
putConverter(LogicalTypeRoot.STRUCTURED_TYPE, RowData.class,
identity());
putConverter(LogicalTypeRoot.RAW, byte[].class,
RawByteArrayConverter::create);
putConverter(LogicalTypeRoot.RAW, RawValueData.class, identity());
+ putConverter(LogicalTypeRoot.UUID, UUID.class,
constructor(UuidUuidConverter::new));
Review Comment:
```suggestion
putConverter(LogicalTypeRoot.UUID, UUID.class,
constructor(UuidUuidConverter::new));
putConverter(LogicalTypeRoot.UUID, byte[].class, identity());
```
--
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]