Store null map size into a variable

This commit is contained in:
Kruglov Pavel 2023-02-13 13:28:09 +01:00 committed by GitHub
parent 04cf144edc
commit d5f413304d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -786,16 +786,17 @@ ColumnPtr ColumnNullable::getNestedColumnWithDefaultOnNull() const
auto res = nested_column->cloneEmpty();
const auto & null_map_data = getNullMapData();
size_t start = 0;
size_t end = null_map->size();
while (start < nested_column->size())
{
size_t next_null_index = start;
while (next_null_index < null_map->size() && !null_map_data[next_null_index])
while (next_null_index < end && !null_map_data[next_null_index])
++next_null_index;
if (next_null_index != start)
res->insertRangeFrom(*nested_column, start, next_null_index - start);
if (next_null_index < null_map->size())
if (next_null_index < end)
res->insertDefault();
start = next_null_index + 1;