Skip to content

[Task]: Implement Frame for Window Functions #1974

@norberttech

Description

@norberttech

What needs to be done?

Currently, window functions in Flow ETL operate on the entire partition:

// Current: AVG operates on entire partition
df()->withEntry('avg_salary', average(ref('salary'))->over(
    window()->partitionBy(ref('department'))
));
// Result: Each row gets the average of ALL rows in its department

Frames allow more granular control:

// With frame: AVG of last 3 rows (moving average)
df()->withEntry('moving_avg', average(ref('salary'))->over(
    window()
        ->partitionBy(ref('department'))
        ->orderBy(ref('date'))
        ->rowsBetween(-2, 0) // 2 preceding + current = 3 rows
));
// Result: Each row gets average of itself and 2 previous rows

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

Status

Todo

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions