twalthr commented on code in PR #29128:
URL: https://github.com/apache/flink/pull/29128#discussion_r3956303393
##########
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/plan/nodes/exec/stream/UuidSemanticTest.java:
##########
@@ -35,6 +35,9 @@ public List<TableTestProgram> programs() {
UuidTestPrograms.UUID_ARRAY,
UuidTestPrograms.UUID_MAP,
UuidTestPrograms.UUID_NESTED_ROW,
+ UuidTestPrograms.UUID_EQUALITY,
+ UuidTestPrograms.UUID_ORDERING,
+ UuidTestPrograms.UUID_LITERAL_FILTER,
Review Comment:
We should have a similar set of programs as in batch. `UUID_GROUP_BY` is
missing, also let's use the same naming scheme, so `UUID_ORDER_BY` instead of
`UUID_ORDERING`
##########
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/plan/nodes/exec/stream/UuidTestPrograms.java:
##########
@@ -112,4 +189,101 @@ private static SourceTestStep singleRowDriver() {
ValidationException.class,
"Invalid UUID string: abcd")
.build();
+
+ private static SourceTestStep groupingSource() {
+ return SourceTestStep.newBuilder("t")
+ .addSchema("id UUID")
+ .producedValues(
+ Row.of(UUID_ZERO),
+ Row.of(UUID_ZERO),
+ Row.of(UUID_A),
+ Row.of(UUID_MAX),
+ Row.of(UUID_MAX),
+ Row.of(UUID_MAX))
+ .build();
+ }
+
+ // The row number encodes the sort position, so a set comparison still
pins down the order:
+ // ZERO < UUID_A (0x55) < HIGH_BIT (0x80) < MAX (0xff) holds only under
the unsigned ordering.
+ static final TableTestProgram UUID_ORDER_BY =
Review Comment:
The class is still under `exec/stream` package. Move up?
##########
flink-table/flink-table-runtime/src/main/java/org/apache/flink/table/runtime/typeutils/TypeCheckUtils.java:
##########
@@ -159,8 +159,7 @@ public static boolean isComparable(LogicalType type) {
&& !isArray(type)
&& !isStructuredType(type)
&& !isVariantType(type)
- && !isBitmapType(type)
- && !isUuidType(type);
+ && !isBitmapType(type);
Review Comment:
Why did you remove it here?
##########
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/plan/nodes/exec/stream/UuidTestPrograms.java:
##########
@@ -104,6 +115,72 @@ private static SourceTestStep singleRowDriver() {
.runSql("INSERT INTO sink_t SELECT (UUID '" + LITERAL_A +
"', 42) FROM t")
.build();
+ private static SourceTestStep comparisonSource() {
+ return SourceTestStep.newBuilder("t")
+ .addSchema("a UUID", "b UUID")
+ .producedValues(
+ Row.of(UUID_ZERO, UUID_ZERO),
+ Row.of(UUID_ZERO, UUID_HIGH_BIT),
+ Row.of(UUID_HIGH_BIT, UUID_ZERO),
+ Row.of(UUID_HIGH_BIT, UUID_MAX),
+ Row.of(UUID_MAX, UUID_MAX))
+ .build();
+ }
+
+ static final TableTestProgram UUID_EQUALITY =
+ TableTestProgram.of("uuid-equality", "compares two UUID columns
for equality")
+ .setupTableSource(comparisonSource())
+ .setupTableSink(
+ SinkTestStep.newBuilder("sink_t")
+ .addSchema("a UUID")
+ .consumedValues(Row.of(UUID_ZERO),
Row.of(UUID_MAX))
+ .build())
+ .runSql("INSERT INTO sink_t SELECT a FROM t WHERE a = b")
+ .build();
+
+ // Both 0x00 < 0x80 and 0x80 < 0xff hold under unsigned ordering. A signed
byte comparison would
+ // drop the first pair (0x00 < 0x80 becomes 0 < -128), so this pins down
the unsigned semantics.
+ static final TableTestProgram UUID_ORDERING =
+ TableTestProgram.of(
+ "uuid-ordering",
+ "compares two UUID columns using unsigned
big-endian byte ordering")
+ .setupTableSource(comparisonSource())
+ .setupTableSink(
+ SinkTestStep.newBuilder("sink_t")
+ .addSchema("a UUID", "b UUID")
+ .consumedValues(
+ Row.of(UUID_ZERO, UUID_HIGH_BIT),
+ Row.of(UUID_HIGH_BIT, UUID_MAX))
+ .build())
+ .runSql("INSERT INTO sink_t SELECT a, b FROM t WHERE a <
b")
+ .build();
+
+ // Only the values whose leading byte has the high bit set are strictly
greater than 0x7fff...
+ // under unsigned ordering. The predicate is pushed into the filterable
source, so this also
+ // exercises the UUID literal round-trip through the expression converter.
+ static final TableTestProgram UUID_LITERAL_FILTER =
Review Comment:
unnecessary information
```suggestion
// under unsigned ordering.
static final TableTestProgram UUID_LITERAL_FILTER =
```
--
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]