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

Incorrect NULL handling in lead window function (SQLancer) #12717

Open
2010YOUY01 opened this issue Oct 2, 2024 · 0 comments
Open

Incorrect NULL handling in lead window function (SQLancer) #12717

2010YOUY01 opened this issue Oct 2, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@2010YOUY01
Copy link
Contributor

Describe the bug

See the reproducer in datafusion-cli (compiled from the latest main, commit 0242767)

> create table t1(v1 int);
0 row(s) fetched.
Elapsed 0.015 seconds.

> insert into t1 values (1);
+-------+
| count |
+-------+
| 1     |
+-------+
1 row(s) fetched.
Elapsed 0.017 seconds.

> SELECT LEAD(NULL, 1, false) OVER () FROM t1;
Arrow error: Cast error: Casting from Boolean to Null not supported

To Reproduce

No response

Expected behavior

This query should be valid, NULL literal can be interpreted as a missing bool value, so 1st and 3rd arg in lead() function have the same type

postgres result:

postgres=# create table t1(v1 int);
iCREATE TABLE
postgres=# insert into t1 values (1);
INSERT 0 1
postgres=# SELECT LEAD(NULL, 1, false) OVER () FROM t1;
 lead 
------
 f
(1 row)

Additional context

Found by SQLancer #11030

@2010YOUY01 2010YOUY01 added the bug Something isn't working label Oct 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant