Skip to content
This repository has been archived by the owner on Sep 18, 2023. It is now read-only.

Peers' values should be considered in window function for CURRENT ROW in range mode #1166

Closed
PHILO-HE opened this issue Nov 8, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@PHILO-HE
Copy link
Collaborator

PHILO-HE commented Nov 8, 2022

Describe the bug
In RANGE mode, CURRENT ROW refers to any peer row of the current row. Rows are peers if they have the same values for the ORDER BY fields. A frame start of CURRENT ROW refers to the first peer row of the current row, while a frame end of CURRENT ROW refers to the last peer row of the current row. If no ORDER BY is specified, all rows are considered peers of the current row.

The default RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT is used in our supported sum window function with sorting. But we have not considered peers in the impl., i.e., we should sum up all peers' values instead of just summing up the value of current single row.

@PHILO-HE
Copy link
Collaborator Author

PHILO-HE commented Nov 8, 2022

This issue can be easily reproduced by executing sql like sum(a) OVER (PARTITION BY b ORDER BY c), where column c has repeated values.

@PHILO-HE
Copy link
Collaborator Author

Fixed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant