fix: Cleanup

This commit is contained in:
Sergey Skvortsov 2022-06-23 08:41:45 +03:00
parent 821400f3de
commit bb0e6fd835
No known key found for this signature in database
GPG Key ID: 120217CE540C3670
4 changed files with 18 additions and 5 deletions

View File

@ -601,7 +601,7 @@ static constexpr UInt64 operator""_GiB(unsigned long long value)
M(Bool, throw_if_no_data_to_insert, true, "Enables or disables empty INSERTs, enabled by default", 0) \
M(Bool, compatibility_ignore_auto_increment_in_create_table, false, "Ignore AUTO_INCREMENT keyword in column declaration if true, otherwise return error. It simplifies migration from MySQL", 0) \
M(Bool, multiple_joins_try_to_keep_original_names, false, "Do not add aliases to top level expression list on multiple joins rewrite", 0) \
M(Bool, allow_grace_hash_join, true, "Allow selecting grace hash join in 'auto' join algorithm", 0) \
M(Bool, allow_grace_hash_join, false, "Allow selecting grace hash join in 'auto' join algorithm", 0) \
M(UInt64, grace_hash_join_initial_buckets, 32, "Initial number of grace hash join buckets", 0) \
M(UInt64, grace_hash_join_max_buckets, 1024, "Limit on the number of grace hash join buckets", 0) \
M(UInt64, grace_hash_join_buffer_size, DBMS_DEFAULT_BUFFER_SIZE, "Buffer size for grace hash join temporary files. It makes sense to use smaller values, especially for SSDs, to save memory", 0) \

View File

@ -1062,8 +1062,6 @@ static std::shared_ptr<IJoin> chooseJoinAlgorithm(std::shared_ptr<TableJoin> ana
return make_merge_join();
else if (analyzed_join->forceGraceHashJoin() || allow_grace_hash_join)
return make_grace_hash_join();
// TODO(sskvor)
// return std::make_shared<JoinSwitcher>(analyzed_join, sample_block, make_grace_hash_join);
return std::make_shared<JoinSwitcher>(analyzed_join, sample_block, make_merge_join);
}

View File

@ -452,6 +452,20 @@ void GraceHashJoin::joinBlock(Block & block, std::shared_ptr<ExtraBlock> & /*not
});
}
void GraceHashJoin::setTotals(const Block & block)
{
if (block)
{
std::scoped_lock guard{totals_mutex};
totals = block;
}
}
const Block & GraceHashJoin::getTotals() const
{
return totals;
}
size_t GraceHashJoin::getTotalRowCount() const
{
assert(first_bucket);

View File

@ -37,8 +37,8 @@ public:
void checkTypesOfKeys(const Block & block) const override;
void joinBlock(Block & block, std::shared_ptr<ExtraBlock> & not_processed) override;
void setTotals(const Block & block) override { totals = block; }
const Block & getTotals() const override { return totals; }
void setTotals(const Block & block) override;
const Block & getTotals() const override;
size_t getTotalRowCount() const override;
size_t getTotalByteCount() const override;
@ -96,6 +96,7 @@ private:
std::atomic<bool> started_reading_delayed_blocks{false};
Block totals;
mutable std::mutex totals_mutex;
};
}