This commit is contained in:
Nikita Taranov 2024-10-25 13:20:00 +01:00
parent 292800eb0a
commit 5f93afede5
3 changed files with 3 additions and 7 deletions

View File

@ -693,16 +693,14 @@ bool HashJoin::addBlockToJoin(ScatteredBlock & source_block, bool check_limits)
if (!flag_per_row && save_nullmap && is_inserted)
{
data->blocks_nullmaps_allocated_size
+= null_map_holder->size() ? null_map_holder->allocatedBytes() * rows / null_map_holder->size() : 0;
data->blocks_nullmaps.emplace_back(stored_block, null_map_holder);
data->blocks_nullmaps_allocated_size += data->blocks_nullmaps.back().allocatedBytes();
}
if (!flag_per_row && not_joined_map && is_inserted)
{
data->blocks_nullmaps_allocated_size
+= not_joined_map->size() ? not_joined_map->allocatedBytes() * rows / not_joined_map->size() : 0;
data->blocks_nullmaps.emplace_back(stored_block, std::move(not_joined_map));
data->blocks_nullmaps_allocated_size += data->blocks_nullmaps.back().allocatedBytes();
}
if (!flag_per_row && !is_inserted)

View File

@ -337,7 +337,7 @@ public:
using RawBlockPtr = const ScatteredBlock *;
struct NullMapHolder
{
size_t allocatedBytes() const { return column->size() ? column->allocatedBytes() * block->rows() / column->size() : 0; }
size_t allocatedBytes() const { return !column->empty() ? column->allocatedBytes() * block->rows() / column->size() : 0; }
RawBlockPtr block;
ColumnPtr column;

View File

@ -254,13 +254,11 @@ struct ScatteredBlock : private boost::noncopyable
/// Whether `block` was scattered, i.e. `selector` != [0, block.rows())
bool wasScattered() const
{
chassert(block);
return selector.size() != block.rows();
}
const ColumnWithTypeAndName & getByName(const std::string & name) const
{
chassert(block);
return block.getByName(name);
}