Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Window functions on MSQ for high and low cardinality data #16126

Open
somu-imply opened this issue Mar 14, 2024 · 1 comment
Open

Window functions on MSQ for high and low cardinality data #16126

somu-imply opened this issue Mar 14, 2024 · 1 comment

Comments

@somu-imply
Copy link
Contributor

somu-imply commented Mar 14, 2024

At this moment, window functions in MSQ rely on materializing the data with the same partition into a rows and columns, process them and output to a frame. In case of low cardinality data (where a single partition has few distinct group and each group has an enormous amount of values) this can lead to running out of memory resources. One solution for this would be to redesign window functions in MSQ by not materializing the data and make multiple passes over the data. Most of the window operations like SUM(), RANK(), RANGE() etc. can be made with 2 passes of the data. We might think to reimplement them in the MSQ way so that we do not have to materialize so much data.

Similarly for data with high cardinality (large number of distinct groups for a column, each with small number of rows for each distinct value), at this moment we add a single group to a frame. This would end up creating a large number of frames. We can get past this by creating a fixed size frame and keep adding to the pending frame. The sorter will process the frames and make sure the data with the correct key reaches the correct processor

@cryptoe
Copy link
Contributor

cryptoe commented Mar 19, 2024

Base PR : #15470

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants