dolthub / dolthub/dolt

Dolt loses an explicit full frame when a named window inherits a base window

Open
#11,458 0 comments 0 reactions 0 assignees View on GitHub
bug correctness customer issue good repro sql
Dominant language
Go
Stars
24.4k
Forks
873
Avg merge
1d 5h
Merged PRs (30d)
108

Description

## What happened

Dolt loses an explicit full frame when a named window inherits a base window.

## Environment

Dolt main commit `91b1a7043126313a349503269230b874afdf8ded` (`dolt version 2.2.3`). MySQL 8.4.9 was used as the compatibility oracle.

## How to reproduce

```sql
CREATE TABLE t(id INT PRIMARY KEY,g INT,a INT);
INSERT INTO t VALUES (1,0,-6),(2,0,8),(3,1,-9);

SELECT id,MAX(a) OVER w AS x
FROM t
WINDOW base AS (PARTITION BY g),
w AS (base ORDER BY id
ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING)
ORDER BY id;
```

The explicit full frame is legal and should be preserved when `w` inherits `PARTITION BY g` from `base`.

## Expected result

MySQL 8.0.43 returns the expected full-frame result:

```text
id x
1 8
2 8
3 -9
```

## Actual result

```text
id,x
1,-6
2,8
3,-9
```

The first row is evaluated as a running frame rather than the requested full partition frame.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by running the SQL reproduction in the issue and compare Dolt's output with the MySQL compatibility result. Trace the named-window inheritance and explicit frame handling, then verify that the query preserves the full partition frame and returns the expected values for all three rows.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, mysql, sql
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.