mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 00:22:29 +00:00
Stratify nans comparison in arrayCompact function
This commit is contained in:
parent
793fd5bfb1
commit
acf312467e
@ -2,6 +2,7 @@
|
||||
#include <DataTypes/DataTypesDecimal.h>
|
||||
#include <Columns/ColumnsNumber.h>
|
||||
#include <Columns/ColumnDecimal.h>
|
||||
#include <Common/HashTable/HashTable.h>
|
||||
#include <Functions/array/FunctionArrayMapped.h>
|
||||
#include <Functions/FunctionFactory.h>
|
||||
|
||||
@ -67,7 +68,7 @@ struct ArrayCompactImpl
|
||||
++res_pos;
|
||||
for (; src_pos < src_offset; ++src_pos)
|
||||
{
|
||||
if (src_values[src_pos] != src_values[src_pos - 1])
|
||||
if (!bitEquals(src_values[src_pos], src_values[src_pos - 1]))
|
||||
{
|
||||
res_values[res_pos] = src_values[src_pos];
|
||||
++res_pos;
|
||||
|
@ -1,7 +1,8 @@
|
||||
[]
|
||||
[1,nan,2]
|
||||
[1,nan,nan,2]
|
||||
[1,nan,nan,nan,2]
|
||||
[1,NULL,2]
|
||||
[1,NULL,nan,2]
|
||||
['hello','','world']
|
||||
[[[]],[[],[]],[[]]]
|
||||
[]
|
||||
|
@ -2,6 +2,7 @@ SELECT arrayCompact([]);
|
||||
SELECT arrayCompact([1, 1, nan, nan, 2, 2, 2]);
|
||||
SELECT arrayCompact([1, 1, nan, nan, -nan, 2, 2, 2]);
|
||||
SELECT arrayCompact([1, 1, NULL, NULL, 2, 2, 2]);
|
||||
SELECT arrayCompact([1, 1, NULL, NULL, nan, nan, 2, 2, 2]);
|
||||
SELECT arrayCompact(['hello', '', '', '', 'world', 'world']);
|
||||
SELECT arrayCompact([[[]], [[], []], [[], []], [[]]]);
|
||||
SELECT arrayCompact(x -> toString(intDiv(x, 3)), range(number)) FROM numbers(10);
|
||||
|
Loading…
Reference in New Issue
Block a user