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

fix(universe): fix SortLimit for empty input group #4701

Merged
merged 3 commits into from
Apr 27, 2022

Conversation

wolffcm
Copy link

@wolffcm wolffcm commented Apr 26, 2022

This PR adds a bit of logic to our handling of sort |> limit to catch the case where we have received an empty table. The code the does merging did not expect to have to deal with zero-row tables, and wound up in an infinite loop.

Done checklist

  • docs/SPEC.md updated (N/A)
  • Test cases written

@wolffcm wolffcm requested review from a team as code owners April 26, 2022 23:09
@wolffcm wolffcm requested review from Marwes and jstirnaman and removed request for a team April 26, 2022 23:09
@@ -331,6 +331,14 @@ func (s *sortTableMergeHeap) ValueLen() int {
}

func (s *sortTableMergeHeap) Table(limit int, mem memory.Allocator) (flux.Table, error) {
if s.ValueLen() == 0 {
// Degenerate case where ther are no rows to merge sort
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Degenerate case where ther are no rows to merge sort
// Degenerate case where there are no rows to merge sort

@wolffcm wolffcm merged commit 9caf569 into master Apr 27, 2022
@wolffcm wolffcm deleted the fix/sort_limit_empty_table branch April 28, 2022 18:14
jsternberg added a commit that referenced this pull request Sep 19, 2022
The sort limit code did not skip chunks with no rows which caused it to
attempt to compare invalid chunks with each other. This skips those rows
but still ensures that the schema is created for them.

This is similar to the same problem that was identified in #4701. That
PR only addressed when the last or only chunk was zero while this one
ensures that the aggregation step also handles this situation properly.
jsternberg added a commit that referenced this pull request Sep 20, 2022
The sort limit code did not skip chunks with no rows which caused it to
attempt to compare invalid chunks with each other. This skips those rows
but still ensures that the schema is created for them.

This is similar to the same problem that was identified in #4701. That
PR only addressed when the last or only chunk was zero while this one
ensures that the aggregation step also handles this situation properly.
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

Successfully merging this pull request may close these issues.

2 participants