CLICKHOUSE-4652 Another fix for АrrayEnumerateUniqRanked with empty arrays

This commit is contained in:
proller 2019-09-12 22:38:34 +03:00
parent 45982253cd
commit 8ce32897fa
3 changed files with 7 additions and 0 deletions

View File

@ -357,6 +357,7 @@ void FunctionArrayEnumerateRankedExtended<Derived>::executeMethodImpl(
{ {
last_offset_by_depth[depth] = (*offsets_by_depth[depth])[current_offset_n_by_depth[depth]]; last_offset_by_depth[depth] = (*offsets_by_depth[depth])[current_offset_n_by_depth[depth]];
++current_offset_n_by_depth[depth]; ++current_offset_n_by_depth[depth];
want_clear = true;
} }
else else
{ {

View File

@ -284,3 +284,6 @@ a1,a2 12 [1,2]
[[1],[],[2],[],[3],[],[4],[],[5],[],[6],[],[7],[],[8],[],[9]] [[1],[],[2],[],[3],[],[4],[],[5],[],[6],[],[7],[],[8],[],[9]]
[[],[1],[],[2],[],[3],[],[4],[],[5],[],[6],[],[7],[],[8]] [[],[1],[],[2],[],[3],[],[4],[],[5],[],[6],[],[7],[],[8]]
[[1],[2],[],[3]] [[1],[2],[],[3]]
-- empty corner
[[],[1],[]] [[],[1],[]]
[[1]] [[1]]

View File

@ -313,3 +313,6 @@ SELECT arrayEnumerateUniqRanked([[1], [], [1]]);
SELECT arrayEnumerateUniqRanked([[1], [], [1], [], [1], [], [1], [], [1], [], [1], [], [1], [], [1], [], [1]]); SELECT arrayEnumerateUniqRanked([[1], [], [1], [], [1], [], [1], [], [1], [], [1], [], [1], [], [1], [], [1]]);
SELECT arrayEnumerateUniqRanked([[], [1], [], [1], [], [1], [], [1], [], [1], [], [1], [], [1], [], [1]]); SELECT arrayEnumerateUniqRanked([[], [1], [], [1], [], [1], [], [1], [], [1], [], [1], [], [1], [], [1]]);
SELECT arrayEnumerateUniqRanked([[1], [1], [], [1]]); SELECT arrayEnumerateUniqRanked([[1], [1], [], [1]]);
select '-- empty corner';
SELECT a, arrayEnumerateUniqRanked(a) FROM ( SELECT * FROM ( SELECT [[],[1],[]] AS a UNION ALL SELECT [[1]] AS a ) ORDER BY a ASC );