apache / apache/datafusion-comet
Support non-Literal default value for `LAG/LEAD`
- Dominant language
- Scala
- Stars
- 1.3k
- Forks
- 373
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 198
Description
### What is the problem the feature request solves?
Comet's native window execution path for `lag` / `lead` only accepts a **literal** as the third (default) argument. Queries like:
```sql
SELECT
b,
LAG(a, 1, c) OVER (ORDER BY b) AS lg,
LEAD(a, 1, c) OVER (ORDER BY b) AS ld
FROM t
```
…where the default expression is a column reference (or any non-Literal expression) currently fall back to Spark. Spark itself supports any expression in this position — the default argument is typed
as Expression, not Literal — so users hitting this pattern lose Comet acceleration on otherwise-supported window plans.
Depends on https://github.com/apache/datafusion/issues/22082
### Describe the potential solution
_No response_
### Additional context
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.