Merge pull request #32456 from ClickHouse/fix-29890

Fix arraySlice with null args.
This commit is contained in:
alexey-milovidov 2021-12-12 06:38:17 +03:00 committed by GitHub
commit 26d606c158
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 1 deletions

View File

@ -102,7 +102,7 @@ public:
{
if (!length_column || length_column->onlyNull())
{
return array_column;
return arguments[0].column;
}
else if (isColumnConst(*length_column))
sink = GatherUtils::sliceFromLeftConstantOffsetBounded(*source, 0, length_column->getInt(0));

View File

@ -35,6 +35,8 @@ slice
[2,NULL,4,5]
['b','c','d']
['b',NULL,'d']
[] 1
[] 1
push back
\N
[1,1]

View File

@ -36,6 +36,7 @@ select arraySlice([1, 2, 3, 4, 5, 6], 10, 1);
select arraySlice([1, 2, Null, 4, 5, 6], 2, 4);
select arraySlice(['a', 'b', 'c', 'd', 'e'], 2, 3);
select arraySlice([Null, 'b', Null, 'd', 'e'], 2, 3);
select arraySlice([], materialize(NULL), NULL), 1 from numbers(2);
select 'push back';
select arrayPushBack(Null, 1);