This is an automated email from the ASF dual-hosted git repository.

jhyde pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/calcite.git


The following commit(s) were added to refs/heads/main by this push:
     new e4e86d3b3e Test case for [CALCITE-4921] Nested NATURAL JOINs or JOINs 
with USING can't find common column
e4e86d3b3e is described below

commit e4e86d3b3eb6a386aa1ec900dafb0be75b78e342
Author: Aleksey Plekhanov <plehanov.a...@gmail.com>
AuthorDate: Tue Jul 2 23:02:20 2024 +0300

    Test case for [CALCITE-4921] Nested NATURAL JOINs or JOINs with USING can't 
find common column
    
    Close apache/calcite#3842
---
 core/src/test/resources/sql/join.iq | 45 +++++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)

diff --git a/core/src/test/resources/sql/join.iq 
b/core/src/test/resources/sql/join.iq
index 012092f30a..e8fa546a39 100644
--- a/core/src/test/resources/sql/join.iq
+++ b/core/src/test/resources/sql/join.iq
@@ -788,4 +788,49 @@ EnumerableCalc(expr#0..7=[{inputs}], 
expr#8=[CAST($t0):INTEGER NOT NULL], expr#9
   EnumerableTableScan(table=[[scott, EMP]])
 !plan
 
+# [CALCITE-4921] Nested NATURAL JOINs can't find common column
+SELECT *
+FROM (VALUES (2, 3), (4, 6), (6, 9)) AS t1(a, b)
+NATURAL JOIN (VALUES (2, 5), (6, 15)) AS t2(a, c)
+NATURAL JOIN (VALUES (2, 7), (4, 14), (6, 21), (8, 28)) AS t3(a, d);
++---+---+----+----+
+| A | B | C  | D  |
++---+---+----+----+
+| 2 | 3 |  5 |  7 |
+| 6 | 9 | 15 | 21 |
++---+---+----+----+
+(2 rows)
+
+!ok
+
+# [CALCITE-4921] Nested JOIN with USING can't find common column
+SELECT *
+FROM (VALUES (2, 3), (4, 6), (6, 9)) AS t1(a, b)
+JOIN (VALUES (2, 5), (6, 15)) AS t2(a, c) USING (a)
+JOIN (VALUES (2, 7), (4, 14), (6, 21), (8, 28)) AS t3(a, d) USING (a);
++---+---+----+----+
+| A | B | C  | D  |
++---+---+----+----+
+| 2 | 3 |  5 |  7 |
+| 6 | 9 | 15 | 21 |
++---+---+----+----+
+(2 rows)
+
+!ok
+
+SELECT *
+FROM (VALUES (2, 3), (4, 6), (6, 9)) AS t1(a, b)
+JOIN (VALUES (2, 5), (6, 15)) AS t2(a, c) USING (a)
+JOIN (VALUES (3, 7), (6, 14), (9, 21), (12, 28), (9, 35)) AS t3(b, d) USING 
(b);
++---+---+----+----+
+| B | A | C  | D  |
++---+---+----+----+
+| 3 | 2 |  5 |  7 |
+| 9 | 6 | 15 | 21 |
+| 9 | 6 | 15 | 35 |
++---+---+----+----+
+(3 rows)
+
+!ok
+
 # End join.iq

Reply via email to