optimize default value

This commit is contained in:
liuneng 2023-12-29 15:29:54 +08:00
parent 18eb75f4d2
commit 5c42f2c041

View File

@ -1102,13 +1102,20 @@ public:
for (size_t i = 0; i < this->size(); ++i)
{
auto& col = columns[i];
size_t default_count = 0;
for (size_t j = 0; j < lazy_output.blocks.size(); ++j)
{
if (!lazy_output.blocks[j])
{
type_name[i].type->insertDefaultInto(*col);
// type_name[i].type->insertDefaultInto(*col);
default_count ++;
continue;
}
if (default_count > 0)
{
JoinCommon::addDefaultValues(*col, type_name[i].type, default_count);
default_count = 0;
}
const auto & column_from_block = reinterpret_cast<const Block *>(lazy_output.blocks[j])->getByPosition(right_indexes[i]);
/// If it's joinGetOrNull, we need to wrap not-nullable columns in StorageJoin.
if (is_join_get)
@ -1122,6 +1129,11 @@ public:
}
col->insertFrom(*column_from_block.column, lazy_output.row_nums[j]);
}
if (default_count > 0)
{
JoinCommon::addDefaultValues(*col, type_name[i].type, default_count);
default_count = 0;
}
}
}