Skip to content

Commit

Permalink
fix(core): MTR + Double prepare on lex unit for ctas with union(#226)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoguangye committed Aug 5, 2022
1 parent 2f07bb2 commit 167845a
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
13 changes: 13 additions & 0 deletions mysql-test/suite/tianmu/r/issue226.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
use test;
CREATE TABLE t1 (f1 VARCHAR(255) CHARACTER SET utf8) ENGINE=TIANMU;
CREATE TABLE t2 AS SELECT LEFT(f1,171) AS f2 FROM t1 UNION SELECT LEFT(f1,171) AS f2 FROM t1;
INSERT INTO t2 VALUES ('a');
INSERT INTO t2 VALUES ('b');
INSERT INTO t2 VALUES ('c');
SELECT * FROM t2;
f2
a
b
c
DROP TABLE t1;
DROP TABLE t2;
9 changes: 9 additions & 0 deletions mysql-test/suite/tianmu/t/issue226.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
use test;
CREATE TABLE t1 (f1 VARCHAR(255) CHARACTER SET utf8) ENGINE=TIANMU;
CREATE TABLE t2 AS SELECT LEFT(f1,171) AS f2 FROM t1 UNION SELECT LEFT(f1,171) AS f2 FROM t1;
INSERT INTO t2 VALUES ('a');
INSERT INTO t2 VALUES ('b');
INSERT INTO t2 VALUES ('c');
SELECT * FROM t2;
DROP TABLE t1;
DROP TABLE t2;
2 changes: 1 addition & 1 deletion storage/tianmu/core/engine_execute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ int st_select_lex_unit::optimize_for_tianmu() {

if (!join->is_optimized()) {
// saved_error = join->prepare(fake_select_lex->table_list.first, 0, 0,
// global_parameters->order_list.elements,
// global_parameters->order_list.elements,
// global_parameters->order_list.first, NULL, NULL, fake_select_lex,
// this); //STONEDB UPGRADE
if(!is_prepared()) {
Expand Down

0 comments on commit 167845a

Please sign in to comment.