mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-17 13:13:36 +00:00
Merge pull request #4614 from proller/fix23
Fix bug in arrayEnumerateRanked
This commit is contained in:
commit
5411920ee7
@ -47,7 +47,7 @@ ArraysDepths getArraysDepths(const ColumnsWithTypeAndName & arguments)
|
||||
UInt64 value = static_cast<const ColumnConst &>(*depth_column).getValue<UInt64>();
|
||||
if (!value)
|
||||
throw Exception("Incorrect arguments for function arrayEnumerateUniqRanked or arrayEnumerateDenseRanked: depth ("
|
||||
+ std::to_string(value) + ") cannot be 0.",
|
||||
+ std::to_string(value) + ") cannot be less or equal 0.",
|
||||
ErrorCodes::BAD_ARGUMENTS);
|
||||
|
||||
if (i == 0)
|
||||
@ -60,6 +60,11 @@ ArraysDepths getArraysDepths(const ColumnsWithTypeAndName & arguments)
|
||||
throw Exception("Incorrect arguments for function arrayEnumerateUniqRanked or arrayEnumerateDenseRanked: depth ("
|
||||
+ std::to_string(value) + ") for missing array.",
|
||||
ErrorCodes::BAD_ARGUMENTS);
|
||||
if (value > prev_array_depth)
|
||||
throw Exception(
|
||||
"Arguments for function arrayEnumerateUniqRanked/arrayEnumerateDenseRanked incorrect: depth="
|
||||
+ std::to_string(value) + " for array with depth=" + std::to_string(prev_array_depth) + ".",
|
||||
ErrorCodes::BAD_ARGUMENTS);
|
||||
|
||||
depths.emplace_back(value);
|
||||
}
|
||||
|
@ -145,11 +145,11 @@ SELECT arrayEnumerateUniqRanked(); -- { serverError 42 }
|
||||
SELECT arrayEnumerateUniqRanked([]);
|
||||
SELECT arrayEnumerateUniqRanked(1); -- { serverError 36 }
|
||||
SELECT arrayEnumerateUniqRanked(2,[]); -- { serverError 36 }
|
||||
SELECT arrayEnumerateUniqRanked(2,[],2); -- { serverError 190 }
|
||||
SELECT arrayEnumerateUniqRanked(2,[],2); -- { serverError 36 }
|
||||
SELECT arrayEnumerateUniqRanked(2,[],[]); -- { serverError 36 }
|
||||
SELECT arrayEnumerateUniqRanked(2,[],[],3); -- { serverError 190 }
|
||||
SELECT arrayEnumerateUniqRanked([],2); -- { serverError 190 }
|
||||
SELECT arrayEnumerateUniqRanked([],2,[]); -- { serverError 190 }
|
||||
SELECT arrayEnumerateUniqRanked(2,[],[],3); -- { serverError 36 }
|
||||
SELECT arrayEnumerateUniqRanked([],2); -- { serverError 36 }
|
||||
SELECT arrayEnumerateUniqRanked([],2,[]); -- { serverError 36 }
|
||||
SELECT arrayEnumerateUniqRanked(0,[],0); -- { serverError 36 }
|
||||
SELECT arrayEnumerateUniqRanked(0,0,0); -- { serverError 36 }
|
||||
SELECT arrayEnumerateUniqRanked(1,1,1); -- { serverError 36 }
|
||||
@ -172,3 +172,11 @@ SELECT arrayEnumerateUniqRanked([1,2], 1, 3, [4], 5); -- { serverError 36 }
|
||||
SELECT arrayEnumerateDenseRanked([[[[[[[[[[42]]]]]]]]]]);
|
||||
SELECT arrayEnumerateUniqRanked('wat', [1,2]); -- { serverError 170 }
|
||||
SELECT arrayEnumerateUniqRanked(1, [1,2], 'boom'); -- { serverError 170 }
|
||||
SELECT arrayEnumerateDenseRanked(['\0'], -8363126); -- { serverError 170 }
|
||||
SELECT arrayEnumerateDenseRanked(-10, ['\0'], -8363126); -- { serverError 170 }
|
||||
SELECT arrayEnumerateDenseRanked(1, ['\0'], -8363126); -- { serverError 170 }
|
||||
SELECT arrayEnumerateDenseRanked(-101, ['\0']); -- { serverError 170 }
|
||||
SELECT arrayEnumerateDenseRanked(1.1, [10,20,10,30]); -- { serverError 170 }
|
||||
SELECT arrayEnumerateDenseRanked([10,20,10,30], 0.4); -- { serverError 170 }
|
||||
SELECT arrayEnumerateDenseRanked([10,20,10,30], 1.8); -- { serverError 170 }
|
||||
SELECT arrayEnumerateUniqRanked(1, [], 1000000000); -- { serverError 36 }
|
||||
|
Loading…
Reference in New Issue
Block a user