[Enhancement] check tuple id is in Descriptor table#53457
Merged
kangkaisen merged 1 commit intoStarRocks:mainfrom Dec 5, 2024
Merged
[Enhancement] check tuple id is in Descriptor table#53457kangkaisen merged 1 commit intoStarRocks:mainfrom
kangkaisen merged 1 commit intoStarRocks:mainfrom
Conversation
Signed-off-by: before-Sunrise <[email protected]>
|
|
||
| void ExecNode::debug_string(int indentation_level, std::stringstream* out) const { | ||
| *out << " conjuncts=" << Expr::debug_string(_conjuncts); | ||
| *out << " id=" << _id; |
There was a problem hiding this comment.
The most risky bug in this code is:
Failure to log an error may lead to incomplete diagnostics info if exceptions occur.
You can modify the code like this:
Status ExecNode::checkTupleIdsInDescs(const DescriptorTbl& descs, const TPlanNode& planNode) {
for (auto id : planNode.row_tuples) {
if (descs.get_tuple_descriptor(id) == nullptr) {
std::stringstream ss;
ss << "Plan node id: " << planNode.node_id << ", Tuple ids: ";
for (auto inner_id : planNode.row_tuples) { // Use distinct var name to avoid shadowing
ss << inner_id << ", ";
}
LOG(ERROR) << ss.str();
ss.str("");
ss << "DescriptorTbl: " << descs.debug_string();
LOG(ERROR) << ss.str();
ss.str("");
ss << "TPlanNode: " << apache::thrift::ThriftDebugString(planNode);
LOG(ERROR) << ss.str();
return Status::InternalError("Tuple ids are not in descs");
}
}
return Status::OK();
}The change ensures that the variable used within the inner loop is distinct (inner_id), helping to prevent subtle bugs related to variable shadowing and ensuring proper logging.
Contributor
[FE Incremental Coverage Report]✅ pass : 0 / 0 (0%) |
Contributor
[Java-Extensions Incremental Coverage Report]✅ pass : 0 / 0 (0%) |
Contributor
[BE Incremental Coverage Report]❌ fail : 5 / 18 (27.78%) file detail
|
Seaven
approved these changes
Dec 5, 2024
satanson
approved these changes
Dec 5, 2024
kangkaisen
approved these changes
Dec 5, 2024
Contributor
|
@Mergifyio backport branch-3.4 |
Contributor
|
@Mergifyio backport branch-3.3 |
Contributor
|
@Mergifyio backport branch-3.2 |
Contributor
|
@Mergifyio backport branch-3.1 |
Contributor
✅ Backports have been createdDetails
|
Contributor
✅ Backports have been createdDetails
|
Contributor
✅ Backports have been createdDetails
|
Contributor
✅ Backports have been createdDetails
|
mergify bot
pushed a commit
that referenced
this pull request
Dec 5, 2024
Signed-off-by: before-Sunrise <[email protected]> (cherry picked from commit 7083dfd)
42 tasks
mergify bot
pushed a commit
that referenced
this pull request
Dec 5, 2024
Signed-off-by: before-Sunrise <[email protected]> (cherry picked from commit 7083dfd)
42 tasks
mergify bot
pushed a commit
that referenced
this pull request
Dec 5, 2024
Signed-off-by: before-Sunrise <[email protected]> (cherry picked from commit 7083dfd)
42 tasks
mergify bot
pushed a commit
that referenced
this pull request
Dec 5, 2024
Signed-off-by: before-Sunrise <[email protected]> (cherry picked from commit 7083dfd)
42 tasks
wanpengfei-git
pushed a commit
that referenced
this pull request
Dec 5, 2024
…#53577) Co-authored-by: before-Sunrise <[email protected]>
wanpengfei-git
pushed a commit
that referenced
this pull request
Dec 5, 2024
…#53578) Co-authored-by: before-Sunrise <[email protected]>
wanpengfei-git
pushed a commit
that referenced
this pull request
Dec 5, 2024
…#53579) Co-authored-by: before-Sunrise <[email protected]>
wanpengfei-git
pushed a commit
that referenced
this pull request
Dec 5, 2024
…#53580) Co-authored-by: before-Sunrise <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why I'm doing:
crash like below is because tuple id is not in Descriptor table, so nullptr will be return, and visit nullptr cause crash
What I'm doing:
check before create node in BE's prepare phase
What type of PR is this:
Does this PR entail a change in behavior?
If yes, please specify the type of change:
Checklist:
Bugfix cherry-pick branch check: