raminqaf commented on code in PR #29128:
URL: https://github.com/apache/flink/pull/29128#discussion_r3958982537


##########
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:
   remvoed



##########
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:
   Updated



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

Reply via email to