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

feat(tianmu): to adapt group by command to MySQL8.0.(#718) #721

Merged
merged 1 commit into from
Oct 14, 2022
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions storage/tianmu/core/engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2056,6 +2056,8 @@ Query_route_to Engine::Handle_Query(THD *thd, Query_expression *qe, Query_result
return Query_route_to::TO_MYSQL;
}

if (with_insert) result->create_table_for_query_block(thd); // used for CTAS

if (lock_tables(thd, thd->lex->query_tables, thd->lex->table_count, 0)) {
TIANMU_LOG(LogCtl_Level::ERROR, "Failed to lock tables for query '%s'", thd->query().str);
return Query_route_to::TO_TIANMU;
Expand Down
4 changes: 2 additions & 2 deletions storage/tianmu/core/engine.ic
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ static int optimize_select(THD *thd, ulong select_options, Query_result *result,
}
} else { // it is a global_opton query block, such as limit, order by, etc.
if (!select_lex->master_query_expression()->is_prepared())
if (err = select_lex->prepare(thd, nullptr)) // stonedb8
if ((err = select_lex->prepare(thd, nullptr)))
{
return err;
}
Expand All @@ -67,7 +67,7 @@ static int optimize_select(THD *thd, ulong select_options, Query_result *result,
} else {
thd_proc_info(thd, "init");
if (!select_lex->master_query_expression()->is_prepared())
if (err = select_lex->prepare(thd, nullptr)) // stonedb8
if ((err = select_lex->prepare(thd, nullptr)))
{
return err;
}
Expand Down
4 changes: 2 additions & 2 deletions storage/tianmu/core/query_compile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -483,9 +483,9 @@ Query_route_to Query::AddFields(mem_root_deque<Item *> &fields, TabID const &tmp

Query_route_to Query::AddGroupByFields(ORDER *group_by, const TabID &tmp_table) {
for (; group_by; group_by = group_by->next) {
if (group_by->direction != ORDER_ASC) {
if (group_by->direction != ORDER_NOT_RELEVANT) {
my_message(ER_SYNTAX_ERROR,
"Tianmu specific error: Using DESC after GROUP BY clause not "
"Tianmu specific error: Using ASC/DESC after GROUP BY clause not "
"allowed. Use "
"ORDER BY to order the result",
MYF(0));
Expand Down