-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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: improve unnest_generic_list
handling of null list
#9975
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks correct to me 👍
if list_array.is_null(row) { | ||
if options.preserve_nulls { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bit surprised that clippy didn't suggest collapsing these together? Either way, would it be slightly more efficient to put the options.preserve_nulls
check first since this would never change per iteration?
Edit: ah nvm, it's because the outer one is an if else 😅
// Create a ListArray with the following list values: | ||
// [A, B, C], [], NULL, [D], NULL, [NULL, F] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice tests 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Which issue does this PR close?
Closes #9932.
Rationale for this change
In a
GenericListArray
, the data in thevalues
corresponding to a null list may not be empty; it can be any data.For example, in the description of this document, the value of the null list is
?
, it's not empty.In this situation, merely checking the
values
is unsafe, we must obtain valid values based on thevalue_offsets
.What changes are included in this PR?
unnest_generic_list
.Are these changes tested?
Yes
Are there any user-facing changes?
No