Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

port position test to scalar #9128

Merged
merged 3 commits into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
Loading