Skip to content

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

Closed

Description

@simonvandel

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

Activity

  1. added a commit that references this issue on Nov 22, 2023
    d55cc20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions