Skip to content

Support non-Literal default value for LAG/LEAD #4268

@comphead

Description

@comphead

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:

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 apache/datafusion#22082

Describe the potential solution

No response

Additional context

No response

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions