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


##########
flink-table/flink-table-planner/src/test/scala/org/apache/flink/table/planner/plan/stream/sql/join/LookupJoinTest.scala:
##########
@@ -366,6 +379,52 @@ class LookupJoinTest extends TableTestBase with 
Serializable {
     util.verifyExecPlan(sql)
   }
 
+  @Test
+  def testJoinFilterableTemporalTableWithUnion(): Unit = {
+    // FLINK-36808: both branches push a different filter into the same dim 
table. The two lookup
+    // joins must stay separate operators; if they are merged, one branch's 
rows are emitted under
+    // the other branch's literal.
+    val sql =
+      """
+        |SELECT s.a, s.b, s.proctime, d.status
+        |FROM MyTable AS s
+        |JOIN LookupTableWithFilterableFields FOR SYSTEM_TIME AS OF s.proctime 
AS d
+        |ON s.a = d.id
+        |WHERE d.status = 'OK'
+        |UNION ALL
+        |SELECT s.a, s.b, s.proctime, d.status
+        |FROM MyTable AS s
+        |JOIN LookupTableWithFilterableFields FOR SYSTEM_TIME AS OF s.proctime 
AS d
+        |ON s.a = d.id
+        |WHERE d.status = 'KO'
+      """.stripMargin
+
+    util.verifyExecPlan(sql)
+  }
+
+  @Test
+  def testJoinFilterableTemporalTableWithUnionSameFilter(): Unit = {
+    // Counterpart to testJoinFilterableTemporalTableWithUnion: with the same 
filter on both sides
+    // the two lookup joins really are equivalent and must still be reused. 
Guards against a fix
+    // that simply makes every lookup join digest unique.
+    val sql =
+      """
+        |SELECT s.a, s.b, s.proctime, d.status
+        |FROM MyTable AS s
+        |JOIN LookupTableWithFilterableFields FOR SYSTEM_TIME AS OF s.proctime 
AS d

Review Comment:
   do these test trigger something that semantic can not?
   Or why do we need them here?



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