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

lag and lead window functions does not accept compatible default value #8307

Closed
simonvandel opened this issue Nov 22, 2023 · 0 comments · Fixed by #9001
Closed

lag and lead window functions does not accept compatible default value #8307

simonvandel opened this issue Nov 22, 2023 · 0 comments · Fixed by #9001
Labels
bug Something isn't working

Comments

@simonvandel
Copy link
Contributor

Describe the bug

The window functions lag and lead allow a default value as its third parameter.
Currently in DataFusion, this needs to be Int64 even though the value selected in the function is not of type Int64.

Postgres docs say that the default value only has to be compatible: https://www.postgresql.org/docs/current/functions-window.html

To Reproduce

DataFusion CLI v33.0.0
❯ create table t1 (a timestamp);
0 rows in set. Query took 0.009 seconds.

❯ insert into t1 values (1),(2),(3);
+-------+
| count |
+-------+
| 3     |
+-------+
1 row in set. Query took 0.013 seconds.

❯ select lag(a, 1, '1970-01-01T00:00:00.000000001'::timestamp) OVER(ORDER BY a) from t1;
Internal error: Expects default value to have Int64 type.
This was likely caused by a bug in DataFusion's code and we would welcome that you file an bug report in our issue tracker

Expected behavior

Allow any default value that can be coerced into the first parameter

Additional context

No response

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
1 participant