Skip to content

Commit a18be6f

Browse files
committed
test: move hash join dictionary regression test to sqllogictest
1 parent ffc5b55 commit a18be6f

2 files changed

Lines changed: 28 additions & 49 deletions

File tree

‎datafusion/core/tests/sql/joins.rs‎

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -299,52 +299,3 @@ async fn unparse_cross_join() -> Result<()> {
299299

300300
Ok(())
301301
}
302-
303-
// Issue #20437: https://github.com/apache/datafusion/issues/20437
304-
#[tokio::test]
305-
async fn test_hash_join_multi_key_dictionary_encoded() -> Result<()> {
306-
let ctx = SessionContext::new();
307-
308-
ctx.sql(
309-
"CREATE TABLE small AS
310-
SELECT id, arrow_cast(region, 'Dictionary(Int32, Utf8)') AS region
311-
FROM (VALUES (1, 'west'), (2, 'west')) AS t(id, region)",
312-
)
313-
.await?
314-
.collect()
315-
.await?;
316-
317-
ctx.sql(
318-
"CREATE TABLE large AS
319-
SELECT id, region, value
320-
FROM (VALUES (1, 'west', 100), (2, 'west', 200), (3, 'east', 300)) AS t(id, region, value)",
321-
)
322-
.await?
323-
.collect()
324-
.await?;
325-
326-
let results = ctx
327-
.sql(
328-
"SELECT s.id, s.region, l.value
329-
FROM small s
330-
JOIN large l ON s.id = l.id AND s.region = l.region
331-
ORDER BY s.id",
332-
)
333-
.await?
334-
.collect()
335-
.await?;
336-
337-
assert_batches_eq!(
338-
[
339-
"+----+--------+-------+",
340-
"| id | region | value |",
341-
"+----+--------+-------+",
342-
"| 1 | west | 100 |",
343-
"| 2 | west | 200 |",
344-
"+----+--------+-------+",
345-
],
346-
&results
347-
);
348-
349-
Ok(())
350-
}

‎datafusion/sqllogictest/test_files/joins.slt‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5290,3 +5290,31 @@ DROP TABLE empty_proj_left;
52905290

52915291
statement count 0
52925292
DROP TABLE empty_proj_right;
5293+
5294+
# Issue #20437: HashJoin panic with dictionary-encoded columns in multi-key joins
5295+
# https://github.com/apache/datafusion/issues/20437
5296+
5297+
statement ok
5298+
CREATE TABLE issue_20437_small AS
5299+
SELECT id, arrow_cast(region, 'Dictionary(Int32, Utf8)') AS region
5300+
FROM (VALUES (1, 'west'), (2, 'west')) AS t(id, region);
5301+
5302+
statement ok
5303+
CREATE TABLE issue_20437_large AS
5304+
SELECT id, region, value
5305+
FROM (VALUES (1, 'west', 100), (2, 'west', 200), (3, 'east', 300)) AS t(id, region, value);
5306+
5307+
query ITI
5308+
SELECT s.id, s.region, l.value
5309+
FROM issue_20437_small s
5310+
JOIN issue_20437_large l ON s.id = l.id AND s.region = l.region
5311+
ORDER BY s.id;
5312+
----
5313+
1 west 100
5314+
2 west 200
5315+
5316+
statement count 0
5317+
DROP TABLE issue_20437_small;
5318+
5319+
statement count 0
5320+
DROP TABLE issue_20437_large;

0 commit comments

Comments
 (0)