Skip to content
This repository was archived by the owner on Sep 27, 2019. It is now read-only.

Commit c748d4d

Browse files
Tianyi Chenapavlo
authored andcommitted
address review request
1 parent ad6f26b commit c748d4d

File tree

2 files changed

+18
-21
lines changed

2 files changed

+18
-21
lines changed

src/executor/plan_executor.cpp

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -63,19 +63,19 @@ static void CompileAndExecutePlan(
6363
codegen::QueryCache::Instance().Add(plan, std::move(compiled_query));
6464
}
6565

66-
auto on_query_result = [&on_complete,
67-
&consumer](executor::ExecutionResult result) {
68-
std::vector<ResultValue> values;
69-
for (const auto &tuple : consumer.GetOutputTuples()) {
70-
for (uint32_t i = 0; i < tuple.tuple_.size(); i++) {
71-
auto column_val = tuple.GetValue(i);
72-
auto str = column_val.IsNull() ? "" : column_val.ToString();
73-
LOG_TRACE("column content: [%s]", str.c_str());
74-
values.push_back(std::move(str));
75-
}
76-
}
77-
on_complete(result, std::move(values));
78-
};
66+
auto on_query_result =
67+
[&on_complete, &consumer](executor::ExecutionResult result) {
68+
std::vector<ResultValue> values;
69+
for (const auto &tuple : consumer.GetOutputTuples()) {
70+
for (uint32_t i = 0; i < tuple.tuple_.size(); i++) {
71+
auto column_val = tuple.GetValue(i);
72+
auto str = column_val.IsNull() ? "" : column_val.ToString();
73+
LOG_TRACE("column content: [%s]", str.c_str());
74+
values.push_back(std::move(str));
75+
}
76+
}
77+
on_complete(result, std::move(values));
78+
};
7979

8080
query->Execute(std::move(executor_context), consumer, on_query_result);
8181
}
@@ -100,7 +100,7 @@ static void InterpretPlan(
100100
status = executor_tree->Init();
101101
if (status != true) {
102102
result.m_result = ResultType::FAILURE;
103-
result.m_error_message = "Executor tree init failed";
103+
result.m_error_message = "Failed initialization of query execution tree";
104104
CleanExecutorTree(executor_tree.get());
105105
on_complete(result, std::move(values));
106106
return;
@@ -157,7 +157,8 @@ void PlanExecutor::ExecutePlan(
157157
ExecutionResult result;
158158
result.m_result = ResultType::FAILURE;
159159
result.m_error_message = e.what();
160-
LOG_ERROR("error thrown in Execution: %s", result.m_error_message.c_str());
160+
LOG_ERROR("Error thrown during execution: %s",
161+
result.m_error_message.c_str());
161162
on_complete(result, {});
162163
}
163164
}

src/planner/insert_plan.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,7 @@ InsertPlan::InsertPlan(storage::DataTable *table,
3737
for (uint32_t tuple_idx = 0; tuple_idx < insert_values->size();
3838
tuple_idx++) {
3939
auto &values = (*insert_values)[tuple_idx];
40-
if (values.size() > schema->GetColumnCount()) {
41-
throw Exception("Column size does not match");
42-
}
40+
PL_ASSERT(values.size() <= schema->GetColumnCount());
4341
uint32_t param_idx = 0;
4442
for (uint32_t column_id = 0; column_id < values.size(); column_id++) {
4543
auto &exp = values[column_id];
@@ -68,9 +66,7 @@ InsertPlan::InsertPlan(storage::DataTable *table,
6866
}
6967
// INSERT INTO table_name (col1, col2, ...) VALUES (val1, val2, ...);
7068
else {
71-
if (columns->size() > schema->GetColumnCount()) {
72-
throw Exception("Column size does not match");
73-
}
69+
PL_ASSERT(columns->size() <= schema->GetColumnCount());
7470
for (uint32_t tuple_idx = 0; tuple_idx < insert_values->size();
7571
tuple_idx++) {
7672
auto &values = (*insert_values)[tuple_idx];

0 commit comments

Comments
 (0)