Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes dolthub/dolt#9035
In
AggregationBuffer.firstBuffer, the buffer should not update if the first row has already been written. However, there was no way of distinguishing between anilbecause the buffer is empty and anilbecause the value in that column of the first row isnil.When you have two rows
(NULL, 1)and(1, NULL), the first row gets written into[]firstBuffer.valas{nil, 1}. Because there's no way to tell whether the first value is supposed to benil, it ends up getting overwritten by the1in the second row. Because the second value is notnil,Updateskips it. As a result, we end up with a row{1, 1}that matches neither of the original rows and evaluates toTRUEwhen grouped byc0 = c1, even though the original rows evaluate toNULL.This isn't an issue when the rows are
(NULL, 1), (NULL, 1)or(1, NULL), (1, NULL)because thenilvalue remains anilvalue whenUpdateis called on the second row.I fixed this by adding a
writtenNilflag tofirstBufferto indicate that thenilvalue is meant to be there and should not be overwritten.