Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
SeaRise committed May 5, 2022
1 parent 7f12002 commit 0a751e5
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
17 changes: 17 additions & 0 deletions dbms/src/Flash/Coprocessor/PushDownFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,23 @@ PushDownFilter::PushDownFilter(
}
}

tipb::Executor * PushDownFilter::constructSelectionForRemoteRead(tipb::Executor * mutable_executor) const
{
if (hasValue())
{
mutable_executor->set_tp(tipb::ExecType::TypeSelection);
mutable_executor->set_executor_id(executor_id);
auto * new_selection = mutable_executor->mutable_selection();
for (const auto & condition : conditions)
*new_selection->add_conditions() = *condition;
return new_selection->mutable_child();
}
else
{
return mutable_executor;
}
}

PushDownFilter PushDownFilter::toPushDownFilter(const tipb::Executor * filter_executor)
{
if (!filter_executor || !filter_executor->has_selection())
Expand Down
2 changes: 2 additions & 0 deletions dbms/src/Flash/Coprocessor/PushDownFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ struct PushDownFilter

bool hasValue() const { return !conditions.empty(); }

tipb::Executor * constructSelectionForRemoteRead(tipb::Executor * mutable_executor) const;

String executor_id;
std::vector<const tipb::Expr *> conditions;
};
Expand Down
10 changes: 1 addition & 9 deletions dbms/src/Flash/Coprocessor/RemoteRequest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,7 @@ RemoteRequest RemoteRequest::build(
tipb::DAGRequest dag_req;
auto * executor = dag_req.mutable_root_executor();

if (push_down_filter.hasValue())
{
executor->set_tp(tipb::ExecType::TypeSelection);
executor->set_executor_id(push_down_filter.executor_id);
auto * new_selection = executor->mutable_selection();
for (const auto & condition : push_down_filter.conditions)
*new_selection->add_conditions() = *condition;
executor = new_selection->mutable_child();
}
executor = push_down_filter.constructSelectionForRemoteRead(executor);

{
tipb::Executor * ts_exec = executor;
Expand Down

0 comments on commit 0a751e5

Please sign in to comment.