Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -197,4 +197,28 @@ public void testBigInput()
" columns => DESCRIPTOR(orderstatus, orderdate, orderpriority, clerk, shippriority, comment)))\n",
"SELECT orderkey, custkey, totalprice FROM tpch.tiny.orders");
}

@Test
public void testExcludeColumnsLateralJoin()
{
// Test LATERAL join with exclude_columns function
// This tests using exclude_columns in a lateral join context with filtering
assertQuery("SELECT n.nationkey, filtered.* " +
"FROM tpch.tiny.nation n " +
"CROSS JOIN LATERAL (" +
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mohsaka : What is the purpose of LATERAL here ? Were you not able to do the same logic with the same SQL without LATERAL ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can, per the expected SQL which has the same result. But I thought we wanted to test lateral in combination with the exclude columns table function result?

" SELECT * " +
" FROM TABLE(" +
" system.builtin.exclude_columns(" +
" input => table(tpch.tiny.region)," +
" columns => descriptor(comment)" +
" )" +
" ) r " +
" WHERE r.regionkey = n.regionkey" +
") filtered " +
"WHERE n.nationkey < 5",
"SELECT n.nationkey, r.regionkey, r.name " +
"FROM tpch.tiny.nation n " +
"JOIN tpch.tiny.region r ON r.regionkey = n.regionkey " +
"WHERE n.nationkey < 5");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -288,4 +288,22 @@ public void testEdgeValues()
" step => %s)) t(x)", start, stop, step),
format("SELECT %s, %s", start, Long.MAX_VALUE - 1));
}

@Test
public void testSequenceLateralJoin()
{
// Test LATERAL join with sequence function
// This tests using sequence in a lateral join context with filtering
assertQuery("SELECT t.nationkey, s.seq " +
"FROM tpch.tiny.nation t " +
"CROSS JOIN LATERAL (" +
" SELECT * " +
" FROM TABLE(system.builtin.sequence(start => 1, stop => 5))" +
") AS s(seq) " +
"WHERE t.nationkey < 3 AND s.seq <= t.regionkey",
"SELECT t.nationkey, s.seq " +
"FROM tpch.tiny.nation t " +
"CROSS JOIN UNNEST(sequence(1, 5)) AS s(seq) " +
"WHERE t.nationkey < 3 AND s.seq <= t.regionkey");
}
}
Loading