snuyanzin commented on code in PR #29200:
URL: https://github.com/apache/flink/pull/29200#discussion_r4021065539


##########
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/plan/nodes/exec/common/LookupJoinTestPrograms.java:
##########
@@ -456,4 +453,97 @@ public class LookupJoinTestPrograms {
                                     + "JOIN customers_t FOR SYSTEM_TIME AS OF 
O.proc_time AS C "
                                     + "ON O.customer_id = C.id")
                     .build();
+
+    /**
+     * {@link #CUSTOMERS} without the after-restore data, so that it is a 
plain {@code
+     * SOURCE_WITH_DATA} step usable from a semantic test.
+     */
+    static final SourceTestStep CUSTOMERS_NO_RESTORE =
+            SourceTestStep.newBuilder("customers_t")
+                    .addOption("disable-lookup", "false") // static/lookup 
table
+                    .addOption("filterable-fields", "age")
+                    .addSchema(CUSTOMERS_SCHEMA)
+                    .producedValues(CUSTOMERS_BEFORE_DATA)
+                    .build();
+
+    /** {@link #ORDERS} without the after-restore data. */
+    static final SourceTestStep ORDERS_NO_RESTORE =
+            SourceTestStep.newBuilder("orders_t")
+                    .addOption("filterable-fields", "customer_id")
+                    .addSchema(ORDERS_SCHEMA)
+                    .producedValues(ORDERS_BEFORE_DATA)
+                    .build();
+
+    private static String filteredLookupJoin(String filter) {
+        return "SELECT "
+                + "O.order_id, "
+                + "O.total, "
+                + "C.id, "
+                + "C.name, "
+                + "C.age, "
+                + "C.city, "
+                + "C.state, "
+                + "C.zipcode "
+                + "FROM orders_t as O "
+                + "JOIN customers_t FOR SYSTEM_TIME AS OF O.proc_time AS C "
+                + "ON O.customer_id = C.id AND "
+                + filter;
+    }
+
+    /**
+     * Both branches select the same columns from the same dim table and 
differ only in the filter
+     * pushed into it, so the two lookup joins are indistinguishable unless 
the pushed-down filter
+     * is part of the lookup join's digest. See FLINK-36808.
+     */
+    private static String unionOfTwoFilteredLookupJoins(String firstFilter, 
String secondFilter) {
+        return "INSERT INTO sink_t "
+                + filteredLookupJoin(firstFilter)
+                + " UNION ALL "
+                + filteredLookupJoin(secondFilter);
+    }
+
+    /**
+     * Only customers older than 30 match, so the second branch contributes 
nothing. If the two

Review Comment:
   that kind of comment that everyone should remember to change in case of 
changing query for whatever reason...



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