-
Notifications
You must be signed in to change notification settings - Fork 7.1k
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 empty array handling in arraySplit #7747
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.
In case like SELECT arraySplit(x -> 0, [])
column mapped
is ColumnConst
and mapped->size()
is zero. However we access it's value in if (column_cut_const->getValue<UInt8>())
(line 68). It works because nested column actually has size 1 and ColumnConst
just returns value of nested column without any checks, but it looks very suspicious.
@@ -6,8 +6,10 @@ | |||
[[1],[2],[3],[4],[5]] | |||
[[1,2],[3,4],[5]] | |||
[[1],[2,3],[4,5]] | |||
[[]] | |||
[[]] | |||
[] |
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.
May be it's better to return [[]]
for empty array to make result more consistent with arraySplit(x -> 0, [1, 2, 3, 4, 5])
, which returns [[1,2,3,4,5]]
(array, which contains the source array)?
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.
Ok for now.
@tavplubix |
Fix empty array handling in arraySplit (cherry picked from commit edede56)
Conflicts with 19.16 |
Fix empty array handling in arraySplit (cherry picked from commit edede56)
I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/?lang=en
Changelog category (leave one):
Changelog entry (up to few sentences, required except for Non-significant/Documentation categories):
Fix #7708 empty array handling in
arraySplit