Merge pull request #6928 from proller/fix27

CLICKHOUSE-4652 Another fix for АrrayEnumerateUniqRanked with empty arrays

(cherry picked from commit ba40858094)
This commit is contained in:
alexey-milovidov 2019-09-13 08:57:30 +03:00 committed by Nikolai Kochetov
parent 1712ef0d5d
commit 1989b50166
3 changed files with 7 additions and 4 deletions

View File

@ -336,10 +336,6 @@ void FunctionArrayEnumerateRankedExtended<Derived>::executeMethodImpl(
/// Skipping offsets if no data in this array
if (prev_off == off)
{
if (depth_to_look > 2)
want_clear = true;
if (depth_to_look >= 2)
{
/// Advance to the next element of the parent array.
@ -357,6 +353,7 @@ void FunctionArrayEnumerateRankedExtended<Derived>::executeMethodImpl(
{
last_offset_by_depth[depth] = (*offsets_by_depth[depth])[current_offset_n_by_depth[depth]];
++current_offset_n_by_depth[depth];
want_clear = true;
}
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]]
[[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]]);
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 );