Skip to content

Commit 2fdf456

Browse files
committed
Add Sequence and Exclude columns function tests with lateral
1 parent ffa70a3 commit 2fdf456

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

presto-tests/src/main/java/com/facebook/presto/tests/TestExcludeColumnsFunction.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,4 +197,28 @@ public void testBigInput()
197197
" columns => DESCRIPTOR(orderstatus, orderdate, orderpriority, clerk, shippriority, comment)))\n",
198198
"SELECT orderkey, custkey, totalprice FROM tpch.tiny.orders");
199199
}
200+
201+
@Test
202+
public void testExcludeColumnsLateralJoin()
203+
{
204+
// Test LATERAL join with exclude_columns function
205+
// This tests using exclude_columns in a lateral join context with filtering
206+
assertQuery("SELECT n.nationkey, r.* " +
207+
"FROM tpch.tiny.nation n " +
208+
"CROSS JOIN LATERAL (" +
209+
" SELECT * " +
210+
" FROM TABLE(" +
211+
" system.builtin.exclude_columns(" +
212+
" input => table(tpch.tiny.region)," +
213+
" columns => descriptor(comment)" +
214+
" )" +
215+
" ) r " +
216+
" WHERE r.regionkey = n.regionkey" +
217+
") r " +
218+
"WHERE n.nationkey < 5",
219+
"SELECT n.nationkey, r.regionkey, r.name " +
220+
"FROM tpch.tiny.nation n " +
221+
"JOIN tpch.tiny.region r ON r.regionkey = n.regionkey " +
222+
"WHERE n.nationkey < 5");
223+
}
200224
}

presto-tests/src/main/java/com/facebook/presto/tests/TestSequenceFunction.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,4 +288,22 @@ public void testEdgeValues()
288288
" step => %s)) t(x)", start, stop, step),
289289
format("SELECT %s, %s", start, Long.MAX_VALUE - 1));
290290
}
291+
292+
@Test
293+
public void testSequenceLateralJoin()
294+
{
295+
// Test LATERAL join with sequence function
296+
// This tests using sequence in a lateral join context with filtering
297+
assertQuery("SELECT t.nationkey, s.seq " +
298+
"FROM tpch.tiny.nation t " +
299+
"CROSS JOIN LATERAL (" +
300+
" SELECT * " +
301+
" FROM TABLE(system.builtin.sequence(start => 1, stop => 5))" +
302+
") AS s(seq) " +
303+
"WHERE t.nationkey < 3 AND s.seq <= t.regionkey",
304+
"SELECT t.nationkey, s.seq " +
305+
"FROM tpch.tiny.nation t " +
306+
"CROSS JOIN UNNEST(sequence(1, 5)) AS s(seq) " +
307+
"WHERE t.nationkey < 3 AND s.seq <= t.regionkey");
308+
}
291309
}

0 commit comments

Comments
 (0)