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

Raise error for streamAgg when plan contains group by key #6382

Merged
merged 5 commits into from
Nov 29, 2022
Merged
Show file tree
Hide file tree
Changes from 4 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
7 changes: 6 additions & 1 deletion dbms/src/Flash/Coprocessor/DAGQueryBlock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <tipb/select.pb.h>
#pragma GCC diagnostic pop

#include <Common/Exception.h>
#include <Common/TiFlashException.h>
#include <Common/TiFlashMetrics.h>
#include <Flash/Coprocessor/DAGQueryBlock.h>
Expand Down Expand Up @@ -52,6 +53,8 @@ const static String TOPN_NAME("topN");
const static String LIMIT_NAME("limit");
const static String EXCHANGE_SENDER_NAME("exchange_sender");

const char * STREAM_AGG_ERROR = "Group by key is not supported in StreamAgg";

static void assignOrThrowException(const tipb::Executor ** to, const tipb::Executor * from, const String & name)
{
if (*to != nullptr)
Expand Down Expand Up @@ -93,8 +96,9 @@ DAGQueryBlock::DAGQueryBlock(const tipb::Executor & root_, QueryBlockIDGenerator
}
current = &current->selection().child();
break;
case tipb::ExecType::TypeAggregation:
case tipb::ExecType::TypeStreamAgg:
RUNTIME_CHECK_MSG(current->aggregation().group_by_size() == 0, STREAM_AGG_ERROR);
case tipb::ExecType::TypeAggregation:
GET_METRIC(tiflash_coprocessor_executor_count, type_agg).Increment();
assignOrThrowException(&aggregation, current, AGG_NAME);
aggregation_name = current->executor_id();
Expand Down Expand Up @@ -199,6 +203,7 @@ DAGQueryBlock::DAGQueryBlock(UInt32 id_, const ::google::protobuf::RepeatedPtrFi
selection_name = std::to_string(i) + "_selection";
break;
case tipb::ExecType::TypeStreamAgg:
RUNTIME_CHECK_MSG(executors[i].aggregation().group_by_size() == 0, STREAM_AGG_ERROR);
case tipb::ExecType::TypeAggregation:
GET_METRIC(tiflash_coprocessor_executor_count, type_agg).Increment();
assignOrThrowException(&aggregation, &executors[i], AGG_NAME);
Expand Down
3 changes: 2 additions & 1 deletion dbms/src/Flash/Planner/PhysicalPlan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,9 @@ void PhysicalPlan::build(const String & executor_id, const tipb::Executor * exec
pushBack(PhysicalFilter::build(context, executor_id, log, executor->selection(), child));
break;
}
case tipb::ExecType::TypeAggregation:
case tipb::ExecType::TypeStreamAgg:
RUNTIME_CHECK_MSG(executor->aggregation().group_by_size() == 0, "Group by key is not supported in StreamAgg");
case tipb::ExecType::TypeAggregation:
GET_METRIC(tiflash_coprocessor_executor_count, type_agg).Increment();
pushBack(PhysicalAggregation::build(context, executor_id, log, executor->aggregation(), FineGrainedShuffle(executor), popBack()));
break;
Expand Down