Skip to content
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

style(execution): improve code readability (#535) #537

Merged
merged 1 commit into from
Sep 22, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions storage/tianmu/core/query.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -748,14 +748,18 @@ TempTable *Query::Preexecute(CompiledQuery &qu, ResultSender *sender, [[maybe_un
}
case CompiledQuery::StepType::APPLY_CONDS: {
int64_t cur_limit = -1;
auto *tb = (TempTable *)ta[-step.t1.n - 1].get();
taofengliu marked this conversation as resolved.
Show resolved Hide resolved

if (qu.FindDistinct(step.t1.n))
((TempTable *)ta[-step.t1.n - 1].get())->SetMode(TMParameter::TM_DISTINCT, 0, 0);
if (qu.NoAggregationOrderingAndDistinct(step.t1.n)) cur_limit = qu.FindLimit(step.t1.n);
tb->SetMode(TMParameter::TM_DISTINCT, 0, 0);
if (qu.NoAggregationOrderingAndDistinct(step.t1.n))
cur_limit = qu.FindLimit(step.t1.n);

ParameterizedFilter *filter = tb->GetFilterP();

if (cur_limit != -1 && ((TempTable *)ta[-step.t1.n - 1].get())->GetFilterP()->NoParameterizedDescs())
if (cur_limit != -1 && filter->NoParameterizedDescs())
cur_limit = -1;

ParameterizedFilter *filter = ((TempTable *)ta[-step.t1.n - 1].get())->GetFilterP();
std::set<int> used_dims = qu.GetUsedDims(step.t1, ta);

// no need any more to check WHERE for not used dims
Expand All @@ -770,11 +774,9 @@ TempTable *Query::Preexecute(CompiledQuery &qu, ResultSender *sender, [[maybe_un
}

if (IsRoughQuery()) {
((TempTable *)ta[-step.t1.n - 1].get())->GetFilterP()->RoughUpdateParamFilter();
filter->RoughUpdateParamFilter();
} else
((TempTable *)ta[-step.t1.n - 1].get())
->GetFilterP()
->UpdateMultiIndex(qu.CountColumnOnly(step.t1), cur_limit);
filter->UpdateMultiIndex(qu.CountColumnOnly(step.t1), cur_limit);
break;
}
case CompiledQuery::StepType::ADD_COLUMN: {
Expand Down