Skip to content

Commit e65b3f3

Browse files
authored
test: Add coverage for NOT IN predicates (apache#23378)
## Which issue does this PR close? - related to apache#23307 ## Rationale for this change As @geoffreyclaude adds additional special implementations for IN lists we should keep up with slt test coverage. The nullable integer coverage already exercises `IN` with and without NULL list values; this adds the corresponding negated `NOT IN` coverage. ## What changes are included in this PR? This adds basic sqllogictest coverage for `NOT IN` predicates in `in_list.slt`, covering each specialized integer type in the nullable IN list table with and without NULL list values. ## Are these changes tested? Tested by CI. ## Are there any user-facing changes? No. This only adds test coverage.
1 parent 55292fb commit e65b3f3

1 file changed

Lines changed: 38 additions & 0 deletions

File tree

‎datafusion/sqllogictest/test_files/in_list.slt‎

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,25 @@ match true true true true true true true true
214214
no_match false false false false false false false false
215215
nulls NULL NULL NULL NULL NULL NULL NULL NULL
216216

217+
# NOT IN without NULL list values returns false for matches and true for non-matches.
218+
query TBBBBBBBB
219+
SELECT
220+
label,
221+
i8 NOT IN (3, 4, 5, 6, 11),
222+
u8 NOT IN (3, 4, 5, 6, 11),
223+
i16 NOT IN (3, 258, 4097, 16385, 11),
224+
u16 NOT IN (3, 258, 4097, 16385, 11),
225+
i32 NOT IN (3, 258, 66051, 16909060, 11),
226+
u32 NOT IN (3, 258, 66051, 16909060, 11),
227+
i64 NOT IN (3, 258, 66051, 16909060, 11),
228+
u64 NOT IN (3, 258, 66051, 16909060, 11)
229+
FROM in_list_ints_nullable
230+
ORDER BY label
231+
----
232+
match false false false false false false false false
233+
no_match true true true true true true true true
234+
nulls NULL NULL NULL NULL NULL NULL NULL NULL
235+
217236
# Null IN list values return true for matches and NULL for non-matches.
218237
query TBBBBBBBB
219238
SELECT
@@ -233,6 +252,25 @@ match true true true true true true true true
233252
no_match NULL NULL NULL NULL NULL NULL NULL NULL
234253
nulls NULL NULL NULL NULL NULL NULL NULL NULL
235254

255+
# Null IN list values return false for matches and NULL for non-matches with NOT IN.
256+
query TBBBBBBBB
257+
SELECT
258+
label,
259+
i8 NOT IN (NULL, 3, 4, 5, 11),
260+
u8 NOT IN (NULL, 3, 4, 5, 11),
261+
i16 NOT IN (NULL, 3, 258, 4097, 11),
262+
u16 NOT IN (NULL, 3, 258, 4097, 11),
263+
i32 NOT IN (NULL, 3, 258, 66051, 11),
264+
u32 NOT IN (NULL, 3, 258, 66051, 11),
265+
i64 NOT IN (NULL, 3, 258, 66051, 11),
266+
u64 NOT IN (NULL, 3, 258, 66051, 11)
267+
FROM in_list_ints_nullable
268+
ORDER BY label
269+
----
270+
match false false false false false false false false
271+
no_match NULL NULL NULL NULL NULL NULL NULL NULL
272+
nulls NULL NULL NULL NULL NULL NULL NULL NULL
273+
236274
# Cleanup
237275
statement ok
238276
DROP TABLE in_list_ints_nullable

0 commit comments

Comments
 (0)