Skip to content

Commit 7b549f5

Browse files
committed
test: cover float IN list predicates
1 parent fb88457 commit 7b549f5

1 file changed

Lines changed: 58 additions & 0 deletions

File tree

datafusion/sqllogictest/test_files/in_list.slt

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,3 +236,61 @@ nulls NULL NULL NULL NULL NULL NULL NULL NULL
236236
# Cleanup
237237
statement ok
238238
DROP TABLE in_list_ints_nullable
239+
240+
####
241+
## Float IN List Specializations
242+
####
243+
244+
statement ok
245+
CREATE TABLE in_list_floats AS
246+
SELECT
247+
label,
248+
arrow_cast(value, 'Float16') AS f16,
249+
arrow_cast(value, 'Float32') AS f32,
250+
arrow_cast(value, 'Float64') AS f64
251+
FROM (VALUES
252+
('match', 11.0),
253+
('no_match', 7.0),
254+
('nulls', NULL)
255+
) AS t(label, value);
256+
257+
# Five element IN lists cover the specialized Float16/32/64 paths.
258+
query TTBBB
259+
SELECT
260+
'Float16',
261+
label,
262+
f16 IN (arrow_cast(3.0, 'Float16'), arrow_cast(4.0, 'Float16'), arrow_cast(5.0, 'Float16'), arrow_cast(6.0, 'Float16'), arrow_cast(11.0, 'Float16')),
263+
f16 IN (arrow_cast(NULL, 'Float16'), arrow_cast(3.0, 'Float16'), arrow_cast(4.0, 'Float16'), arrow_cast(5.0, 'Float16'), arrow_cast(11.0, 'Float16')),
264+
f16 IN (arrow_cast(3.0, 'Float16'), arrow_cast(4.0, 'Float16'), arrow_cast(5.0, 'Float16'), arrow_cast(6.0, 'Float16'), arrow_cast(8.0, 'Float16'))
265+
FROM in_list_floats
266+
UNION ALL
267+
SELECT
268+
'Float32',
269+
label,
270+
f32 IN (arrow_cast(3.0, 'Float32'), arrow_cast(4.0, 'Float32'), arrow_cast(5.0, 'Float32'), arrow_cast(6.0, 'Float32'), arrow_cast(11.0, 'Float32')),
271+
f32 IN (arrow_cast(NULL, 'Float32'), arrow_cast(3.0, 'Float32'), arrow_cast(4.0, 'Float32'), arrow_cast(5.0, 'Float32'), arrow_cast(11.0, 'Float32')),
272+
f32 IN (arrow_cast(3.0, 'Float32'), arrow_cast(4.0, 'Float32'), arrow_cast(5.0, 'Float32'), arrow_cast(6.0, 'Float32'), arrow_cast(8.0, 'Float32'))
273+
FROM in_list_floats
274+
UNION ALL
275+
SELECT
276+
'Float64',
277+
label,
278+
f64 IN (arrow_cast(3.0, 'Float64'), arrow_cast(4.0, 'Float64'), arrow_cast(5.0, 'Float64'), arrow_cast(6.0, 'Float64'), arrow_cast(11.0, 'Float64')),
279+
f64 IN (arrow_cast(NULL, 'Float64'), arrow_cast(3.0, 'Float64'), arrow_cast(4.0, 'Float64'), arrow_cast(5.0, 'Float64'), arrow_cast(11.0, 'Float64')),
280+
f64 IN (arrow_cast(3.0, 'Float64'), arrow_cast(4.0, 'Float64'), arrow_cast(5.0, 'Float64'), arrow_cast(6.0, 'Float64'), arrow_cast(8.0, 'Float64'))
281+
FROM in_list_floats
282+
ORDER BY 1, 2
283+
----
284+
Float16 match true true false
285+
Float16 no_match false NULL false
286+
Float16 nulls NULL NULL NULL
287+
Float32 match true true false
288+
Float32 no_match false NULL false
289+
Float32 nulls NULL NULL NULL
290+
Float64 match true true false
291+
Float64 no_match false NULL false
292+
Float64 nulls NULL NULL NULL
293+
294+
# Cleanup
295+
statement ok
296+
DROP TABLE in_list_floats

0 commit comments

Comments
 (0)