Skip to content

Commit

Permalink
port position test to scalar (apache#9128)
Browse files Browse the repository at this point in the history
* port position test to scalar
  • Loading branch information
Lordworms authored Feb 8, 2024
1 parent 10ae934 commit e578337
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 43 deletions.
43 changes: 0 additions & 43 deletions datafusion/sqllogictest/test_files/position.slt

This file was deleted.

39 changes: 39 additions & 0 deletions datafusion/sqllogictest/test_files/scalar.slt
Original file line number Diff line number Diff line change
Expand Up @@ -1957,3 +1957,42 @@ query T
SELECT CASE 3 WHEN 1+2 THEN 'first' WHEN 1+1+1 THEN 'second' END
----
first

# position test
query I
select position('world' in 'hello world');
----
7

# test in expression
query I
select 1000 where position('world' in 'hello world') != 100;
----
1000

# test in expression
query I
select 100000 where position('legend' in 'league of legend') != 11;
----

# test in expression
query I
select 100000 where position('legend' in 'league of legend') = 11;
----
100000

# test null
query ?
select position(null in null)
----
NULL


query I
select position('' in '')
----
1


query error DataFusion error: Error during planning: The "instr" function can only accept strings, but got Int64\.
select position(1 in 1)

0 comments on commit e578337

Please sign in to comment.