Skip to content

SQL: lagInFrame/leadInFrame need distinct WindowFuncKind variants, not Lag/Lead #267

Description

@milindsrivastava1997

`lower_window_func_kind` (`crates/frontend-sql/src/sql/mod.rs:1633`) doesn't recognize ClickHouse's `lagInFrame`/`leadInFrame`, so both fail to lower — 5 occurrences in the `bgp_jan2024_workload` 200-query corpus (#219).

The obvious fix — map them onto the existing `WindowFuncKind::Lag`/`Lead` — is wrong: ANSI `LAG`/`LEAD` (and DataFusion's native `lag`/`lead`, which `Lag`/`Lead` already model) are defined to ignore the window frame entirely, while ClickHouse's `*InFrame` family respects it. Conflating them under one variant means the frame clause is sometimes meaningful and sometimes silently ignored depending on which name got you there.

Related: #231.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions