-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Fixed some uninitialized variables #5850
Conversation
@@ -589,8 +594,7 @@ bool CsvScanNode::split_check_fill(const std::string& line, RuntimeState* state) | |||
} | |||
} | |||
|
|||
for (std::map<std::string, TMiniLoadEtlFunction>::iterator iter = _column_function_map.begin(); | |||
iter != _column_function_map.end(); iter++) { | |||
for (auto iter = _column_function_map.begin(); iter != _column_function_map.end(); ++iter) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for (auto iter = _column_function_map.begin(); iter != _column_function_map.end(); ++iter) { | |
for (auto& iter = _column_function_map.begin(); iter != _column_function_map.end(); ++iter) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not necessary to pass a reference here
iterator won't generate a extra memory copy here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
@@ -436,7 +437,7 @@ void FragmentMgr::_exec_actual(std::shared_ptr<FragmentExecState> exec_state, Fi | |||
{ | |||
std::lock_guard<std::mutex> lock(_lock); | |||
_fragment_map.erase(exec_state->fragment_instance_id()); | |||
if (all_done) { | |||
if (all_done && fragments_ctx) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it necessary to judge fragments_ctx
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
std::shared_ptr<QueryFragmentsCtx> fragments_ctx = exec_state->get_fragments_ctx();
bool all_done = false;
// what will happen if fragments_ctx is null ?
if (fragments_ctx != nullptr) {
// decrease the number of unfinished fragments
all_done = fragments_ctx->countdown();
}
// remove exec state after this fragment finished
{
std::lock_guard<std::mutex> lock(_lock);
_fragment_map.erase(exec_state->fragment_instance_id());
if (all_done && fragments_ctx) {
// it seems that the fragments_ctxmay be NULL
_fragments_ctx_map.erase(fragments_ctx->query_id);
it seems that the fragments_ctx may be NULL
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
@@ -431,7 +430,7 @@ class Roaring64Map { | |||
bool isSubset(const Roaring64Map& r) const { | |||
for (const auto& map_entry : roarings) { | |||
auto roaring_iter = r.roarings.find(map_entry.first); | |||
if (roaring_iter == roarings.cend()) | |||
if (roaring_iter == r.roarings.cend()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it a serious bug?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CRoaring has fixed it https://github.com/RoaringBitmap/CRoaring/blob/master/cpp/roaring64map.hh
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Fixed some potential bugs caused by uninitialized variables
Proposed changes
Fixed some potential bugs caused by uninitialisation
Types of changes
What types of changes does your code introduce to Doris?
Put an
x
in the boxes that applyChecklist
Put an
x
in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.Further comments
If this is a relatively large or complex change, kick off the discussion at dev@doris.apache.org by explaining why you chose the solution you did and what alternatives you considered, etc...