Skip to content

Commit add3f8d

Browse files
committed
test: add NULL pattern cases for SIMILAR TO planning
1 parent 69f531e commit add3f8d

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

‎datafusion/sqllogictest/test_files/type_coercion.slt‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,24 @@ SELECT t.s NOT SIMILAR TO arrow_cast(p.pat, 'Utf8View') FROM t CROSS JOIN p;
366366
----
367367
false
368368

369+
# NULL patterns (literal or Null-typed non-scalar) are accepted by the planner
370+
# and evaluate to NULL
371+
query B
372+
SELECT t.s SIMILAR TO NULL FROM t;
373+
----
374+
NULL
375+
376+
statement ok
377+
CREATE TABLE pn AS SELECT NULL AS pat;
378+
379+
query B
380+
SELECT t.s SIMILAR TO pn.pat FROM t CROSS JOIN pn;
381+
----
382+
NULL
383+
384+
statement ok
385+
DROP TABLE pn;
386+
369387
statement ok
370388
DROP TABLE t;
371389

0 commit comments

Comments
 (0)