mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-15 10:52:30 +00:00
fixed check
This commit is contained in:
parent
adb46fa174
commit
dc5cc0a541
@ -550,6 +550,8 @@ ColumnPtr FunctionArrayIntersect::execute(const UnpackedArrays & arrays, Mutable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We update offsets for all the arrays except the first one. Offsets for the first array would be updated later.
|
||||||
|
// It is needed to iterate the first array again so that the elements in the result would have fixed order.
|
||||||
if (arg_num)
|
if (arg_num)
|
||||||
{
|
{
|
||||||
prev_off[arg_num] = off;
|
prev_off[arg_num] = off;
|
||||||
@ -573,12 +575,18 @@ ColumnPtr FunctionArrayIntersect::execute(const UnpackedArrays & arrays, Mutable
|
|||||||
for (auto i : collections::range(prev_off[0], off))
|
for (auto i : collections::range(prev_off[0], off))
|
||||||
{
|
{
|
||||||
all_has_nullable = all_nullable;
|
all_has_nullable = all_nullable;
|
||||||
current_has_nullable = false;
|
|
||||||
typename Map::LookupResult pair = nullptr;
|
typename Map::LookupResult pair = nullptr;
|
||||||
|
|
||||||
if (arg.null_map && (*arg.null_map)[i])
|
if (arg.null_map && (*arg.null_map)[i])
|
||||||
{
|
{
|
||||||
current_has_nullable = true;
|
current_has_nullable = true;
|
||||||
|
if (all_has_nullable && !null_added)
|
||||||
|
{
|
||||||
|
++result_offset;
|
||||||
|
result_data.insertDefault();
|
||||||
|
null_map.push_back(1);
|
||||||
|
null_added = true;
|
||||||
|
}
|
||||||
if (null_added)
|
if (null_added)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -602,29 +610,20 @@ ColumnPtr FunctionArrayIntersect::execute(const UnpackedArrays & arrays, Mutable
|
|||||||
|
|
||||||
if (pair && pair->getMapped() == args)
|
if (pair && pair->getMapped() == args)
|
||||||
{
|
{
|
||||||
|
// We increase pair->getMapped() here to not skip duplicate values from the first array.
|
||||||
++pair->getMapped();
|
++pair->getMapped();
|
||||||
++result_offset;
|
++result_offset;
|
||||||
if constexpr (is_numeric_column)
|
if constexpr (is_numeric_column)
|
||||||
{
|
{
|
||||||
if (pair->getKey() == columns[0]->getElement(i))
|
result_data.insertValue(pair->getKey());
|
||||||
{
|
|
||||||
result_data.insertValue(pair->getKey());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if constexpr (std::is_same_v<ColumnType, ColumnString> || std::is_same_v<ColumnType, ColumnFixedString>)
|
else if constexpr (std::is_same_v<ColumnType, ColumnString> || std::is_same_v<ColumnType, ColumnFixedString>)
|
||||||
{
|
{
|
||||||
if (pair->getKey() == columns[0]->getDataAt(i))
|
result_data.insertData(pair->getKey().data, pair->getKey().size);
|
||||||
{
|
|
||||||
result_data.insertData(pair->getKey().data, pair->getKey().size);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const char * data = nullptr;
|
result_data.deserializeAndInsertFromArena(pair->getKey().data);
|
||||||
if (pair->getKey() == columns[0]->serializeValueIntoArena(i, arena, data))
|
|
||||||
{
|
|
||||||
result_data.deserializeAndInsertFromArena(pair->getKey().data);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (all_nullable)
|
if (all_nullable)
|
||||||
null_map.push_back(0);
|
null_map.push_back(0);
|
||||||
|
Loading…
Reference in New Issue
Block a user