summaryrefslogtreecommitdiff
path: root/storage/spider/mysql-test
diff options
context:
space:
mode:
Diffstat (limited to 'storage/spider/mysql-test')
-rw-r--r--storage/spider/mysql-test/spider/include/direct_join_using_deinit.inc9
-rw-r--r--storage/spider/mysql-test/spider/include/direct_join_using_init.inc13
-rw-r--r--storage/spider/mysql-test/spider/include/direct_left_join_deinit.inc9
-rw-r--r--storage/spider/mysql-test/spider/include/direct_left_join_init.inc13
-rw-r--r--storage/spider/mysql-test/spider/include/direct_left_join_nullable_deinit.inc9
-rw-r--r--storage/spider/mysql-test/spider/include/direct_left_join_nullable_init.inc13
-rw-r--r--storage/spider/mysql-test/spider/include/direct_left_right_join_nullable_deinit.inc9
-rw-r--r--storage/spider/mysql-test/spider/include/direct_left_right_join_nullable_init.inc13
-rw-r--r--storage/spider/mysql-test/spider/include/direct_left_right_left_join_nullable_deinit.inc9
-rw-r--r--storage/spider/mysql-test/spider/include/direct_left_right_left_join_nullable_init.inc13
-rw-r--r--storage/spider/mysql-test/spider/include/direct_right_join_deinit.inc9
-rw-r--r--storage/spider/mysql-test/spider/include/direct_right_join_init.inc13
-rw-r--r--storage/spider/mysql-test/spider/include/direct_right_join_nullable_deinit.inc9
-rw-r--r--storage/spider/mysql-test/spider/include/direct_right_join_nullable_init.inc13
-rw-r--r--storage/spider/mysql-test/spider/include/direct_right_left_join_nullable_deinit.inc9
-rw-r--r--storage/spider/mysql-test/spider/include/direct_right_left_join_nullable_init.inc13
-rw-r--r--storage/spider/mysql-test/spider/include/direct_right_left_right_join_nullable_deinit.inc9
-rw-r--r--storage/spider/mysql-test/spider/include/direct_right_left_right_join_nullable_init.inc13
-rw-r--r--storage/spider/mysql-test/spider/r/direct_join_using.result108
-rw-r--r--storage/spider/mysql-test/spider/r/direct_left_join.result108
-rw-r--r--storage/spider/mysql-test/spider/r/direct_left_join_nullable.result113
-rw-r--r--storage/spider/mysql-test/spider/r/direct_left_right_join_nullable.result113
-rw-r--r--storage/spider/mysql-test/spider/r/direct_left_right_left_join_nullable.result112
-rw-r--r--storage/spider/mysql-test/spider/r/direct_right_join.result108
-rw-r--r--storage/spider/mysql-test/spider/r/direct_right_join_nullable.result113
-rw-r--r--storage/spider/mysql-test/spider/r/direct_right_left_join_nullable.result112
-rw-r--r--storage/spider/mysql-test/spider/r/direct_right_left_right_join_nullable.result113
-rw-r--r--storage/spider/mysql-test/spider/t/direct_join_using.test197
-rw-r--r--storage/spider/mysql-test/spider/t/direct_left_join.test197
-rw-r--r--storage/spider/mysql-test/spider/t/direct_left_join_nullable.test212
-rw-r--r--storage/spider/mysql-test/spider/t/direct_left_right_join_nullable.test212
-rw-r--r--storage/spider/mysql-test/spider/t/direct_left_right_left_join_nullable.test212
-rw-r--r--storage/spider/mysql-test/spider/t/direct_right_join.test197
-rw-r--r--storage/spider/mysql-test/spider/t/direct_right_join_nullable.test212
-rw-r--r--storage/spider/mysql-test/spider/t/direct_right_left_join_nullable.test212
-rw-r--r--storage/spider/mysql-test/spider/t/direct_right_left_right_join_nullable.test212
36 files changed, 3061 insertions, 0 deletions
diff --git a/storage/spider/mysql-test/spider/include/direct_join_using_deinit.inc b/storage/spider/mysql-test/spider/include/direct_join_using_deinit.inc
new file mode 100644
index 00000000000..53bc29a0016
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/direct_join_using_deinit.inc
@@ -0,0 +1,9 @@
+--let $OUTPUT_CHILD_GROUP2= $OUTPUT_CHILD_GROUP2_BACKUP
+--let $USE_GENERAL_LOG= $USE_GENERAL_LOG_BACKUP
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/include/direct_join_using_init.inc b/storage/spider/mysql-test/spider/include/direct_join_using_init.inc
new file mode 100644
index 00000000000..7e4947bf078
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/direct_join_using_init.inc
@@ -0,0 +1,13 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_init.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+let $CHILD2_1_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+--let $OUTPUT_CHILD_GROUP2_BACKUP= $OUTPUT_CHILD_GROUP2
+--let $OUTPUT_CHILD_GROUP2= 1
+--let $USE_GENERAL_LOG_BACKUP= $USE_GENERAL_LOG
+--let $USE_GENERAL_LOG= 1
diff --git a/storage/spider/mysql-test/spider/include/direct_left_join_deinit.inc b/storage/spider/mysql-test/spider/include/direct_left_join_deinit.inc
new file mode 100644
index 00000000000..53bc29a0016
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/direct_left_join_deinit.inc
@@ -0,0 +1,9 @@
+--let $OUTPUT_CHILD_GROUP2= $OUTPUT_CHILD_GROUP2_BACKUP
+--let $USE_GENERAL_LOG= $USE_GENERAL_LOG_BACKUP
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/include/direct_left_join_init.inc b/storage/spider/mysql-test/spider/include/direct_left_join_init.inc
new file mode 100644
index 00000000000..7e4947bf078
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/direct_left_join_init.inc
@@ -0,0 +1,13 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_init.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+let $CHILD2_1_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+--let $OUTPUT_CHILD_GROUP2_BACKUP= $OUTPUT_CHILD_GROUP2
+--let $OUTPUT_CHILD_GROUP2= 1
+--let $USE_GENERAL_LOG_BACKUP= $USE_GENERAL_LOG
+--let $USE_GENERAL_LOG= 1
diff --git a/storage/spider/mysql-test/spider/include/direct_left_join_nullable_deinit.inc b/storage/spider/mysql-test/spider/include/direct_left_join_nullable_deinit.inc
new file mode 100644
index 00000000000..53bc29a0016
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/direct_left_join_nullable_deinit.inc
@@ -0,0 +1,9 @@
+--let $OUTPUT_CHILD_GROUP2= $OUTPUT_CHILD_GROUP2_BACKUP
+--let $USE_GENERAL_LOG= $USE_GENERAL_LOG_BACKUP
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/include/direct_left_join_nullable_init.inc b/storage/spider/mysql-test/spider/include/direct_left_join_nullable_init.inc
new file mode 100644
index 00000000000..7e4947bf078
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/direct_left_join_nullable_init.inc
@@ -0,0 +1,13 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_init.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+let $CHILD2_1_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+--let $OUTPUT_CHILD_GROUP2_BACKUP= $OUTPUT_CHILD_GROUP2
+--let $OUTPUT_CHILD_GROUP2= 1
+--let $USE_GENERAL_LOG_BACKUP= $USE_GENERAL_LOG
+--let $USE_GENERAL_LOG= 1
diff --git a/storage/spider/mysql-test/spider/include/direct_left_right_join_nullable_deinit.inc b/storage/spider/mysql-test/spider/include/direct_left_right_join_nullable_deinit.inc
new file mode 100644
index 00000000000..53bc29a0016
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/direct_left_right_join_nullable_deinit.inc
@@ -0,0 +1,9 @@
+--let $OUTPUT_CHILD_GROUP2= $OUTPUT_CHILD_GROUP2_BACKUP
+--let $USE_GENERAL_LOG= $USE_GENERAL_LOG_BACKUP
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/include/direct_left_right_join_nullable_init.inc b/storage/spider/mysql-test/spider/include/direct_left_right_join_nullable_init.inc
new file mode 100644
index 00000000000..7e4947bf078
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/direct_left_right_join_nullable_init.inc
@@ -0,0 +1,13 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_init.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+let $CHILD2_1_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+--let $OUTPUT_CHILD_GROUP2_BACKUP= $OUTPUT_CHILD_GROUP2
+--let $OUTPUT_CHILD_GROUP2= 1
+--let $USE_GENERAL_LOG_BACKUP= $USE_GENERAL_LOG
+--let $USE_GENERAL_LOG= 1
diff --git a/storage/spider/mysql-test/spider/include/direct_left_right_left_join_nullable_deinit.inc b/storage/spider/mysql-test/spider/include/direct_left_right_left_join_nullable_deinit.inc
new file mode 100644
index 00000000000..53bc29a0016
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/direct_left_right_left_join_nullable_deinit.inc
@@ -0,0 +1,9 @@
+--let $OUTPUT_CHILD_GROUP2= $OUTPUT_CHILD_GROUP2_BACKUP
+--let $USE_GENERAL_LOG= $USE_GENERAL_LOG_BACKUP
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/include/direct_left_right_left_join_nullable_init.inc b/storage/spider/mysql-test/spider/include/direct_left_right_left_join_nullable_init.inc
new file mode 100644
index 00000000000..7e4947bf078
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/direct_left_right_left_join_nullable_init.inc
@@ -0,0 +1,13 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_init.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+let $CHILD2_1_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+--let $OUTPUT_CHILD_GROUP2_BACKUP= $OUTPUT_CHILD_GROUP2
+--let $OUTPUT_CHILD_GROUP2= 1
+--let $USE_GENERAL_LOG_BACKUP= $USE_GENERAL_LOG
+--let $USE_GENERAL_LOG= 1
diff --git a/storage/spider/mysql-test/spider/include/direct_right_join_deinit.inc b/storage/spider/mysql-test/spider/include/direct_right_join_deinit.inc
new file mode 100644
index 00000000000..53bc29a0016
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/direct_right_join_deinit.inc
@@ -0,0 +1,9 @@
+--let $OUTPUT_CHILD_GROUP2= $OUTPUT_CHILD_GROUP2_BACKUP
+--let $USE_GENERAL_LOG= $USE_GENERAL_LOG_BACKUP
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/include/direct_right_join_init.inc b/storage/spider/mysql-test/spider/include/direct_right_join_init.inc
new file mode 100644
index 00000000000..7e4947bf078
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/direct_right_join_init.inc
@@ -0,0 +1,13 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_init.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+let $CHILD2_1_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+--let $OUTPUT_CHILD_GROUP2_BACKUP= $OUTPUT_CHILD_GROUP2
+--let $OUTPUT_CHILD_GROUP2= 1
+--let $USE_GENERAL_LOG_BACKUP= $USE_GENERAL_LOG
+--let $USE_GENERAL_LOG= 1
diff --git a/storage/spider/mysql-test/spider/include/direct_right_join_nullable_deinit.inc b/storage/spider/mysql-test/spider/include/direct_right_join_nullable_deinit.inc
new file mode 100644
index 00000000000..53bc29a0016
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/direct_right_join_nullable_deinit.inc
@@ -0,0 +1,9 @@
+--let $OUTPUT_CHILD_GROUP2= $OUTPUT_CHILD_GROUP2_BACKUP
+--let $USE_GENERAL_LOG= $USE_GENERAL_LOG_BACKUP
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/include/direct_right_join_nullable_init.inc b/storage/spider/mysql-test/spider/include/direct_right_join_nullable_init.inc
new file mode 100644
index 00000000000..7e4947bf078
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/direct_right_join_nullable_init.inc
@@ -0,0 +1,13 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_init.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+let $CHILD2_1_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+--let $OUTPUT_CHILD_GROUP2_BACKUP= $OUTPUT_CHILD_GROUP2
+--let $OUTPUT_CHILD_GROUP2= 1
+--let $USE_GENERAL_LOG_BACKUP= $USE_GENERAL_LOG
+--let $USE_GENERAL_LOG= 1
diff --git a/storage/spider/mysql-test/spider/include/direct_right_left_join_nullable_deinit.inc b/storage/spider/mysql-test/spider/include/direct_right_left_join_nullable_deinit.inc
new file mode 100644
index 00000000000..53bc29a0016
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/direct_right_left_join_nullable_deinit.inc
@@ -0,0 +1,9 @@
+--let $OUTPUT_CHILD_GROUP2= $OUTPUT_CHILD_GROUP2_BACKUP
+--let $USE_GENERAL_LOG= $USE_GENERAL_LOG_BACKUP
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/include/direct_right_left_join_nullable_init.inc b/storage/spider/mysql-test/spider/include/direct_right_left_join_nullable_init.inc
new file mode 100644
index 00000000000..7e4947bf078
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/direct_right_left_join_nullable_init.inc
@@ -0,0 +1,13 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_init.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+let $CHILD2_1_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+--let $OUTPUT_CHILD_GROUP2_BACKUP= $OUTPUT_CHILD_GROUP2
+--let $OUTPUT_CHILD_GROUP2= 1
+--let $USE_GENERAL_LOG_BACKUP= $USE_GENERAL_LOG
+--let $USE_GENERAL_LOG= 1
diff --git a/storage/spider/mysql-test/spider/include/direct_right_left_right_join_nullable_deinit.inc b/storage/spider/mysql-test/spider/include/direct_right_left_right_join_nullable_deinit.inc
new file mode 100644
index 00000000000..53bc29a0016
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/direct_right_left_right_join_nullable_deinit.inc
@@ -0,0 +1,9 @@
+--let $OUTPUT_CHILD_GROUP2= $OUTPUT_CHILD_GROUP2_BACKUP
+--let $USE_GENERAL_LOG= $USE_GENERAL_LOG_BACKUP
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
diff --git a/storage/spider/mysql-test/spider/include/direct_right_left_right_join_nullable_init.inc b/storage/spider/mysql-test/spider/include/direct_right_left_right_join_nullable_init.inc
new file mode 100644
index 00000000000..7e4947bf078
--- /dev/null
+++ b/storage/spider/mysql-test/spider/include/direct_right_left_right_join_nullable_init.inc
@@ -0,0 +1,13 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source ../t/test_init.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+let $CHILD2_1_SELECT_ARGUMENT1=
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+--let $OUTPUT_CHILD_GROUP2_BACKUP= $OUTPUT_CHILD_GROUP2
+--let $OUTPUT_CHILD_GROUP2= 1
+--let $USE_GENERAL_LOG_BACKUP= $USE_GENERAL_LOG
+--let $USE_GENERAL_LOG= 1
diff --git a/storage/spider/mysql-test/spider/r/direct_join_using.result b/storage/spider/mysql-test/spider/r/direct_join_using.result
new file mode 100644
index 00000000000..66ae1503f9f
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/direct_join_using.result
@@ -0,0 +1,108 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+drop and create databases
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+DROP DATABASE IF EXISTS auto_test_remote;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+test select 1
+connection master_1;
+SELECT 1;
+1
+1
+connection child2_1;
+SELECT 1;
+1
+1
+
+create table and insert
+connection child2_1;
+CHILD2_1_DROP_TABLES
+CHILD2_1_DROP_TABLES6
+CHILD2_1_DROP_TABLES5
+CHILD2_1_CREATE_TABLES
+CHILD2_1_CREATE_TABLES6
+CHILD2_1_CREATE_TABLES5
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+DROP TABLE IF EXISTS tbl_a;
+CREATE TABLE tbl_a (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10',
+PRIMARY KEY(a),
+KEY idx1(b)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+CREATE TABLE tbl_b (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1
+CREATE TABLE tbl_c (
+a INT AUTO_INCREMENT,
+b INT DEFAULT 10,
+c INT DEFAULT 11,
+PRIMARY KEY(a),
+KEY idx1(b),
+KEY idx2(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1
+insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+insert into tbl_c values (1,10,100),(2,20,200),(3,30,300),(4,40,400),(5,50,500);
+
+select test
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT a.a, c.b, c.c FROM tbl_a a join tbl_b b using(a) join tbl_c c using(a) ORDER BY a.b DESC;
+a b c
+5 50 500
+4 40 400
+3 30 300
+2 20 200
+1 10 100
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select t0.`b` `b`,t0.`a` `a`,t2.`b` `b`,t2.`c` `c` from `auto_test_remote`.`ta_r` t0,`auto_test_remote`.`ta_r_3` t1,`auto_test_remote`.`ta_r_int` t2 where ((t0.`a` = t1.`a`) and (t2.`a` = t1.`a`)) order by t0.`b` desc
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2000-01-01 00:00:00
+2 b 2000-01-02 00:00:00
+3 c 2000-01-03 00:00:00
+4 d 2000-01-04 00:00:00
+5 e 2000-01-05 00:00:00
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/r/direct_left_join.result b/storage/spider/mysql-test/spider/r/direct_left_join.result
new file mode 100644
index 00000000000..b63f0661b2e
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/direct_left_join.result
@@ -0,0 +1,108 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+drop and create databases
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+DROP DATABASE IF EXISTS auto_test_remote;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+test select 1
+connection master_1;
+SELECT 1;
+1
+1
+connection child2_1;
+SELECT 1;
+1
+1
+
+create table and insert
+connection child2_1;
+CHILD2_1_DROP_TABLES
+CHILD2_1_DROP_TABLES6
+CHILD2_1_DROP_TABLES5
+CHILD2_1_CREATE_TABLES
+CHILD2_1_CREATE_TABLES6
+CHILD2_1_CREATE_TABLES5
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+DROP TABLE IF EXISTS tbl_a;
+CREATE TABLE tbl_a (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10',
+PRIMARY KEY(a),
+KEY idx1(b)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+CREATE TABLE tbl_b (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1
+CREATE TABLE tbl_c (
+a INT AUTO_INCREMENT,
+b INT DEFAULT 10,
+c INT DEFAULT 11,
+PRIMARY KEY(a),
+KEY idx1(b),
+KEY idx2(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1
+insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+insert into tbl_c values (1,10,100),(2,20,200),(3,30,300),(4,40,400),(5,50,500);
+
+select test
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT a.a, c.b, c.c FROM tbl_a a left join tbl_b b on a.a = b.a left join tbl_c c on a.a = c.a ORDER BY a.b DESC;
+a b c
+5 50 500
+4 40 400
+3 30 300
+2 20 200
+1 10 100
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select t0.`b` `b`,t0.`a` `a`,t2.`b` `b`,t2.`c` `c` from `auto_test_remote`.`ta_r` t0 left join `auto_test_remote`.`ta_r_3` t1 on (t1.`a` = t0.`a`) left join `auto_test_remote`.`ta_r_int` t2 on (t2.`a` = t0.`a`) where 1 order by t0.`b` desc
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2000-01-01 00:00:00
+2 b 2000-01-02 00:00:00
+3 c 2000-01-03 00:00:00
+4 d 2000-01-04 00:00:00
+5 e 2000-01-05 00:00:00
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/r/direct_left_join_nullable.result b/storage/spider/mysql-test/spider/r/direct_left_join_nullable.result
new file mode 100644
index 00000000000..e646bc9bf38
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/direct_left_join_nullable.result
@@ -0,0 +1,113 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+drop and create databases
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+DROP DATABASE IF EXISTS auto_test_remote;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+test select 1
+connection master_1;
+SELECT 1;
+1
+1
+connection child2_1;
+SELECT 1;
+1
+1
+
+create table and insert
+connection child2_1;
+CHILD2_1_DROP_TABLES
+CHILD2_1_DROP_TABLES6
+CHILD2_1_DROP_TABLES4
+CHILD2_1_DROP_TABLES3
+CHILD2_1_CREATE_TABLES
+CHILD2_1_CREATE_TABLES6
+CHILD2_1_CREATE_TABLES4
+CHILD2_1_CREATE_TABLES3
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+DROP TABLE IF EXISTS tbl_a;
+CREATE TABLE tbl_a (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10',
+KEY idx0(a),
+KEY idx1(b)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+CREATE TABLE tbl_b (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1
+CREATE TABLE tbl_c (
+a INT AUTO_INCREMENT,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10',
+KEY idx0(a),
+KEY idx1(b),
+KEY idx2(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1
+CREATE TABLE tbl_d (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1
+insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02');
+insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03');
+insert into tbl_c values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04');
+insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+
+select test
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT a.a, c.b, c.c, d.a FROM tbl_d a left join tbl_c b on a.a = b.a left join tbl_b c on b.c = c.c left join tbl_a d on c.b = d.b ORDER BY a.a DESC;
+a b c a
+5 NULL NULL NULL
+4 NULL NULL NULL
+3 c 2000-01-03 00:00:00 NULL
+2 b 2000-01-02 00:00:00 2
+1 a 2000-01-01 00:00:00 1
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select t0.`a` `a`,t2.`b` `b`,t2.`c` `c`,t3.`a` `a` from `auto_test_remote`.`ta_r_no_idx` t0 left join `auto_test_remote`.`ta_r_auto_inc` t1 on ((t1.`a` = t0.`a`) and (t0.`a` is not null)) left join `auto_test_remote`.`ta_r_3` t2 on (t2.`c` = t1.`c`) left join `auto_test_remote`.`ta_r` t3 on ((t3.`b` = t2.`b`) and (t2.`b` is not null)) where 1 order by t0.`a` desc
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2000-01-01 00:00:00
+2 b 2000-01-02 00:00:00
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/r/direct_left_right_join_nullable.result b/storage/spider/mysql-test/spider/r/direct_left_right_join_nullable.result
new file mode 100644
index 00000000000..f3c6e189444
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/direct_left_right_join_nullable.result
@@ -0,0 +1,113 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+drop and create databases
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+DROP DATABASE IF EXISTS auto_test_remote;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+test select 1
+connection master_1;
+SELECT 1;
+1
+1
+connection child2_1;
+SELECT 1;
+1
+1
+
+create table and insert
+connection child2_1;
+CHILD2_1_DROP_TABLES
+CHILD2_1_DROP_TABLES6
+CHILD2_1_DROP_TABLES4
+CHILD2_1_DROP_TABLES3
+CHILD2_1_CREATE_TABLES
+CHILD2_1_CREATE_TABLES6
+CHILD2_1_CREATE_TABLES4
+CHILD2_1_CREATE_TABLES3
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+DROP TABLE IF EXISTS tbl_a;
+CREATE TABLE tbl_a (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10',
+KEY idx0(a),
+KEY idx1(b)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+CREATE TABLE tbl_b (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1
+CREATE TABLE tbl_c (
+a INT AUTO_INCREMENT,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10',
+KEY idx0(a),
+KEY idx1(b),
+KEY idx2(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1
+CREATE TABLE tbl_d (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1
+insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02');
+insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03');
+insert into tbl_c values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04');
+insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+
+select test
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT a.a, c.b, c.c, d.a FROM tbl_a a left join tbl_b b on a.a = b.a left join tbl_c c on b.c = c.c right join tbl_d d on c.b = d.b ORDER BY d.a DESC;
+a b c a
+NULL NULL NULL 5
+NULL NULL NULL 4
+NULL NULL NULL 3
+2 b 2000-01-02 00:00:00 2
+1 a 2000-01-01 00:00:00 1
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select t0.`a` `a`,t2.`b` `b`,t2.`c` `c`,t3.`a` `a` from `auto_test_remote`.`ta_r_no_idx` t3 left join (`auto_test_remote`.`ta_r_auto_inc` t2 join `auto_test_remote`.`ta_r_3` t1 join `auto_test_remote`.`ta_r` t0) on ((t2.`b` = t3.`b`) and (t2.`c` = t1.`c`) and (t0.`a` = t1.`a`) and (t1.`a` is not null) and (t3.`b` is not null)) where 1 order by t3.`a` desc
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2000-01-01 00:00:00
+2 b 2000-01-02 00:00:00
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/r/direct_left_right_left_join_nullable.result b/storage/spider/mysql-test/spider/r/direct_left_right_left_join_nullable.result
new file mode 100644
index 00000000000..88205fb0f65
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/direct_left_right_left_join_nullable.result
@@ -0,0 +1,112 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+drop and create databases
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+DROP DATABASE IF EXISTS auto_test_remote;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+test select 1
+connection master_1;
+SELECT 1;
+1
+1
+connection child2_1;
+SELECT 1;
+1
+1
+
+create table and insert
+connection child2_1;
+CHILD2_1_DROP_TABLES
+CHILD2_1_DROP_TABLES6
+CHILD2_1_DROP_TABLES4
+CHILD2_1_DROP_TABLES3
+CHILD2_1_CREATE_TABLES
+CHILD2_1_CREATE_TABLES6
+CHILD2_1_CREATE_TABLES4
+CHILD2_1_CREATE_TABLES3
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+DROP TABLE IF EXISTS tbl_a;
+CREATE TABLE tbl_a (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10',
+KEY idx0(a),
+KEY idx1(b)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+CREATE TABLE tbl_b (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1
+CREATE TABLE tbl_c (
+a INT AUTO_INCREMENT,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10',
+KEY idx0(a),
+KEY idx1(b),
+KEY idx2(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1
+CREATE TABLE tbl_d (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1
+insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02');
+insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03');
+insert into tbl_c values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04');
+insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+
+select test
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT a.a, c.b, c.c, d.a FROM tbl_a a left join tbl_b b on a.a = b.a right join tbl_c c on b.c = c.c left join tbl_d d on c.b = d.b ORDER BY d.a DESC;
+a b c a
+NULL d 2000-01-04 00:00:00 4
+NULL c 2000-01-03 00:00:00 3
+2 b 2000-01-02 00:00:00 2
+1 a 2000-01-01 00:00:00 1
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select t0.`a` `a`,t2.`b` `b`,t2.`c` `c`,t3.`a` `a` from `auto_test_remote`.`ta_r_auto_inc` t2 left join (`auto_test_remote`.`ta_r_3` t1 join `auto_test_remote`.`ta_r` t0) on ((t1.`c` = t2.`c`) and (t0.`a` = t1.`a`) and (t1.`a` is not null)) left join `auto_test_remote`.`ta_r_no_idx` t3 on (t3.`b` = t2.`b`) where 1 order by t3.`a` desc
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2000-01-01 00:00:00
+2 b 2000-01-02 00:00:00
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/r/direct_right_join.result b/storage/spider/mysql-test/spider/r/direct_right_join.result
new file mode 100644
index 00000000000..8edfb682292
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/direct_right_join.result
@@ -0,0 +1,108 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+drop and create databases
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+DROP DATABASE IF EXISTS auto_test_remote;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+test select 1
+connection master_1;
+SELECT 1;
+1
+1
+connection child2_1;
+SELECT 1;
+1
+1
+
+create table and insert
+connection child2_1;
+CHILD2_1_DROP_TABLES
+CHILD2_1_DROP_TABLES6
+CHILD2_1_DROP_TABLES5
+CHILD2_1_CREATE_TABLES
+CHILD2_1_CREATE_TABLES6
+CHILD2_1_CREATE_TABLES5
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+DROP TABLE IF EXISTS tbl_a;
+CREATE TABLE tbl_a (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10',
+PRIMARY KEY(a),
+KEY idx1(b)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+CREATE TABLE tbl_b (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1
+CREATE TABLE tbl_c (
+a INT AUTO_INCREMENT,
+b INT DEFAULT 10,
+c INT DEFAULT 11,
+PRIMARY KEY(a),
+KEY idx1(b),
+KEY idx2(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1
+insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+insert into tbl_c values (1,10,100),(2,20,200),(3,30,300),(4,40,400),(5,50,500);
+
+select test
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT a.a, c.b, c.c FROM tbl_a a right join tbl_b b on a.a = b.a right join tbl_c c on a.a = c.a ORDER BY a.b DESC;
+a b c
+5 50 500
+4 40 400
+3 30 300
+2 20 200
+1 10 100
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select t0.`b` `b`,t0.`a` `a`,t2.`b` `b`,t2.`c` `c` from `auto_test_remote`.`ta_r_int` t2 left join (`auto_test_remote`.`ta_r` t0 join `auto_test_remote`.`ta_r_3` t1) on ((t0.`a` = t2.`a`) and (t1.`a` = t2.`a`)) where 1 order by t0.`b` desc
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2000-01-01 00:00:00
+2 b 2000-01-02 00:00:00
+3 c 2000-01-03 00:00:00
+4 d 2000-01-04 00:00:00
+5 e 2000-01-05 00:00:00
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/r/direct_right_join_nullable.result b/storage/spider/mysql-test/spider/r/direct_right_join_nullable.result
new file mode 100644
index 00000000000..a05781cb6d6
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/direct_right_join_nullable.result
@@ -0,0 +1,113 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+drop and create databases
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+DROP DATABASE IF EXISTS auto_test_remote;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+test select 1
+connection master_1;
+SELECT 1;
+1
+1
+connection child2_1;
+SELECT 1;
+1
+1
+
+create table and insert
+connection child2_1;
+CHILD2_1_DROP_TABLES
+CHILD2_1_DROP_TABLES6
+CHILD2_1_DROP_TABLES4
+CHILD2_1_DROP_TABLES3
+CHILD2_1_CREATE_TABLES
+CHILD2_1_CREATE_TABLES6
+CHILD2_1_CREATE_TABLES4
+CHILD2_1_CREATE_TABLES3
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+DROP TABLE IF EXISTS tbl_a;
+CREATE TABLE tbl_a (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10',
+KEY idx0(a),
+KEY idx1(b)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+CREATE TABLE tbl_b (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1
+CREATE TABLE tbl_c (
+a INT AUTO_INCREMENT,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10',
+KEY idx0(a),
+KEY idx1(b),
+KEY idx2(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1
+CREATE TABLE tbl_d (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1
+insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02');
+insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03');
+insert into tbl_c values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04');
+insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+
+select test
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT a.a, c.b, c.c, d.a FROM tbl_a a right join tbl_b b on a.a = b.a right join tbl_c c on b.c = c.c right join tbl_d d on c.b = d.b ORDER BY d.a DESC;
+a b c a
+NULL NULL NULL 5
+NULL d 2000-01-04 00:00:00 4
+NULL c 2000-01-03 00:00:00 3
+2 b 2000-01-02 00:00:00 2
+1 a 2000-01-01 00:00:00 1
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select t0.`a` `a`,t2.`b` `b`,t2.`c` `c`,t3.`a` `a` from `auto_test_remote`.`ta_r_no_idx` t3 left join `auto_test_remote`.`ta_r_auto_inc` t2 on ((t2.`b` = t3.`b`) and (t3.`b` is not null)) left join `auto_test_remote`.`ta_r_3` t1 on (t1.`c` = t2.`c`) left join `auto_test_remote`.`ta_r` t0 on ((t0.`a` = t1.`a`) and (t1.`a` is not null)) where 1 order by t3.`a` desc
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2000-01-01 00:00:00
+2 b 2000-01-02 00:00:00
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/r/direct_right_left_join_nullable.result b/storage/spider/mysql-test/spider/r/direct_right_left_join_nullable.result
new file mode 100644
index 00000000000..25e0913ba06
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/direct_right_left_join_nullable.result
@@ -0,0 +1,112 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+drop and create databases
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+DROP DATABASE IF EXISTS auto_test_remote;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+test select 1
+connection master_1;
+SELECT 1;
+1
+1
+connection child2_1;
+SELECT 1;
+1
+1
+
+create table and insert
+connection child2_1;
+CHILD2_1_DROP_TABLES
+CHILD2_1_DROP_TABLES6
+CHILD2_1_DROP_TABLES4
+CHILD2_1_DROP_TABLES3
+CHILD2_1_CREATE_TABLES
+CHILD2_1_CREATE_TABLES6
+CHILD2_1_CREATE_TABLES4
+CHILD2_1_CREATE_TABLES3
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+DROP TABLE IF EXISTS tbl_a;
+CREATE TABLE tbl_a (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10',
+KEY idx0(a),
+KEY idx1(b)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+CREATE TABLE tbl_b (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1
+CREATE TABLE tbl_c (
+a INT AUTO_INCREMENT,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10',
+KEY idx0(a),
+KEY idx1(b),
+KEY idx2(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1
+CREATE TABLE tbl_d (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1
+insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02');
+insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03');
+insert into tbl_c values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04');
+insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+
+select test
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT a.a, c.b, c.c, d.a FROM tbl_a a right join tbl_b b on a.a = b.a right join tbl_c c on b.c = c.c left join tbl_d d on c.b = d.b ORDER BY d.a DESC;
+a b c a
+NULL d 2000-01-04 00:00:00 4
+NULL c 2000-01-03 00:00:00 3
+2 b 2000-01-02 00:00:00 2
+1 a 2000-01-01 00:00:00 1
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select t0.`a` `a`,t2.`b` `b`,t2.`c` `c`,t3.`a` `a` from `auto_test_remote`.`ta_r_auto_inc` t2 left join `auto_test_remote`.`ta_r_3` t1 on (t1.`c` = t2.`c`) left join `auto_test_remote`.`ta_r` t0 on ((t0.`a` = t1.`a`) and (t1.`a` is not null)) left join `auto_test_remote`.`ta_r_no_idx` t3 on (t3.`b` = t2.`b`) where 1 order by t3.`a` desc
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2000-01-01 00:00:00
+2 b 2000-01-02 00:00:00
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/r/direct_right_left_right_join_nullable.result b/storage/spider/mysql-test/spider/r/direct_right_left_right_join_nullable.result
new file mode 100644
index 00000000000..48cd9c2c75f
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/direct_right_left_right_join_nullable.result
@@ -0,0 +1,113 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+drop and create databases
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = 'TABLE,FILE';
+DROP DATABASE IF EXISTS auto_test_remote;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+test select 1
+connection master_1;
+SELECT 1;
+1
+1
+connection child2_1;
+SELECT 1;
+1
+1
+
+create table and insert
+connection child2_1;
+CHILD2_1_DROP_TABLES
+CHILD2_1_DROP_TABLES6
+CHILD2_1_DROP_TABLES4
+CHILD2_1_DROP_TABLES3
+CHILD2_1_CREATE_TABLES
+CHILD2_1_CREATE_TABLES6
+CHILD2_1_CREATE_TABLES4
+CHILD2_1_CREATE_TABLES3
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+DROP TABLE IF EXISTS tbl_a;
+CREATE TABLE tbl_a (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10',
+KEY idx0(a),
+KEY idx1(b)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+CREATE TABLE tbl_b (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1
+CREATE TABLE tbl_c (
+a INT AUTO_INCREMENT,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10',
+KEY idx0(a),
+KEY idx1(b),
+KEY idx2(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1
+CREATE TABLE tbl_d (
+a INT DEFAULT 10,
+b CHAR(1) DEFAULT 'c',
+c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1
+insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02');
+insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03');
+insert into tbl_c values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04');
+insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+
+select test
+connection child2_1;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+SELECT a.a, c.b, c.c, d.a FROM tbl_a a right join tbl_b b on a.a = b.a left join tbl_c c on b.c = c.c right join tbl_d d on c.b = d.b ORDER BY d.a DESC;
+a b c a
+NULL NULL NULL 5
+NULL NULL NULL 4
+NULL c 2000-01-03 00:00:00 3
+2 b 2000-01-02 00:00:00 2
+1 a 2000-01-01 00:00:00 1
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
+argument
+select t0.`a` `a`,t2.`b` `b`,t2.`c` `c`,t3.`a` `a` from `auto_test_remote`.`ta_r_no_idx` t3 left join (`auto_test_remote`.`ta_r_auto_inc` t2 join `auto_test_remote`.`ta_r_3` t1 left join `auto_test_remote`.`ta_r` t0 on ((t0.`a` = t1.`a`) and (t1.`a` is not null))) on ((t2.`b` = t3.`b`) and (t2.`c` = t1.`c`) and (t3.`b` is not null)) where 1 order by t3.`a` desc
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
+SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a;
+a b date_format(c, '%Y-%m-%d %H:%i:%s')
+1 a 2000-01-01 00:00:00
+2 b 2000-01-02 00:00:00
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/t/direct_join_using.test b/storage/spider/mysql-test/spider/t/direct_join_using.test
new file mode 100644
index 00000000000..819e56ff21c
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/direct_join_using.test
@@ -0,0 +1,197 @@
+--source ../include/direct_join_using_init.inc
+
+--echo
+--echo drop and create databases
+--connection master_1
+--disable_warnings
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SET @old_log_output = @@global.log_output;
+ SET GLOBAL log_output = 'TABLE,FILE';
+ }
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo create table and insert
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES;
+ echo CHILD2_1_DROP_TABLES6;
+ echo CHILD2_1_DROP_TABLES5;
+ echo CHILD2_1_CREATE_TABLES;
+ echo CHILD2_1_CREATE_TABLES6;
+ echo CHILD2_1_CREATE_TABLES5;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES;
+ eval $CHILD2_1_DROP_TABLES6;
+ eval $CHILD2_1_DROP_TABLES5;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES;
+ eval $CHILD2_1_CREATE_TABLES6;
+ eval $CHILD2_1_CREATE_TABLES5;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS tbl_a;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a),
+ KEY idx1(b)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_a (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a),
+ KEY idx1(b)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+echo CREATE TABLE tbl_b (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1;
+eval CREATE TABLE tbl_b (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1;
+echo CREATE TABLE tbl_c (
+ a INT AUTO_INCREMENT,
+ b INT DEFAULT 10,
+ c INT DEFAULT 11,
+ PRIMARY KEY(a),
+ KEY idx1(b),
+ KEY idx2(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1;
+eval CREATE TABLE tbl_c (
+ a INT AUTO_INCREMENT,
+ b INT DEFAULT 10,
+ c INT DEFAULT 11,
+ PRIMARY KEY(a),
+ KEY idx1(b),
+ KEY idx2(c)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1;
+--enable_query_log
+insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+insert into tbl_c values (1,10,100),(2,20,200),(3,30,300),(4,40,400),(5,50,500);
+
+--echo
+--echo select test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--connection master_1
+SELECT a.a, c.b, c.c FROM tbl_a a join tbl_b b using(a) join tbl_c c using(a) ORDER BY a.b DESC;
+
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ eval $CHILD2_1_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ if ($USE_GENERAL_LOG)
+ {
+ SET GLOBAL log_output = @old_log_output;
+ }
+}
+--enable_warnings
+--source ../include/direct_join_using_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/t/direct_left_join.test b/storage/spider/mysql-test/spider/t/direct_left_join.test
new file mode 100644
index 00000000000..e09b6a12488
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/direct_left_join.test
@@ -0,0 +1,197 @@
+--source ../include/direct_left_join_init.inc
+
+--echo
+--echo drop and create databases
+--connection master_1
+--disable_warnings
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SET @old_log_output = @@global.log_output;
+ SET GLOBAL log_output = 'TABLE,FILE';
+ }
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo create table and insert
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES;
+ echo CHILD2_1_DROP_TABLES6;
+ echo CHILD2_1_DROP_TABLES5;
+ echo CHILD2_1_CREATE_TABLES;
+ echo CHILD2_1_CREATE_TABLES6;
+ echo CHILD2_1_CREATE_TABLES5;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES;
+ eval $CHILD2_1_DROP_TABLES6;
+ eval $CHILD2_1_DROP_TABLES5;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES;
+ eval $CHILD2_1_CREATE_TABLES6;
+ eval $CHILD2_1_CREATE_TABLES5;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS tbl_a;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a),
+ KEY idx1(b)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_a (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a),
+ KEY idx1(b)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+echo CREATE TABLE tbl_b (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1;
+eval CREATE TABLE tbl_b (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1;
+echo CREATE TABLE tbl_c (
+ a INT AUTO_INCREMENT,
+ b INT DEFAULT 10,
+ c INT DEFAULT 11,
+ PRIMARY KEY(a),
+ KEY idx1(b),
+ KEY idx2(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1;
+eval CREATE TABLE tbl_c (
+ a INT AUTO_INCREMENT,
+ b INT DEFAULT 10,
+ c INT DEFAULT 11,
+ PRIMARY KEY(a),
+ KEY idx1(b),
+ KEY idx2(c)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1;
+--enable_query_log
+insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+insert into tbl_c values (1,10,100),(2,20,200),(3,30,300),(4,40,400),(5,50,500);
+
+--echo
+--echo select test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--connection master_1
+SELECT a.a, c.b, c.c FROM tbl_a a left join tbl_b b on a.a = b.a left join tbl_c c on a.a = c.a ORDER BY a.b DESC;
+
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ eval $CHILD2_1_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ if ($USE_GENERAL_LOG)
+ {
+ SET GLOBAL log_output = @old_log_output;
+ }
+}
+--enable_warnings
+--source ../include/direct_left_join_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/t/direct_left_join_nullable.test b/storage/spider/mysql-test/spider/t/direct_left_join_nullable.test
new file mode 100644
index 00000000000..dc67a01b4b2
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/direct_left_join_nullable.test
@@ -0,0 +1,212 @@
+--source ../include/direct_left_join_nullable_init.inc
+
+--echo
+--echo drop and create databases
+--connection master_1
+--disable_warnings
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SET @old_log_output = @@global.log_output;
+ SET GLOBAL log_output = 'TABLE,FILE';
+ }
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo create table and insert
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES;
+ echo CHILD2_1_DROP_TABLES6;
+ echo CHILD2_1_DROP_TABLES4;
+ echo CHILD2_1_DROP_TABLES3;
+ echo CHILD2_1_CREATE_TABLES;
+ echo CHILD2_1_CREATE_TABLES6;
+ echo CHILD2_1_CREATE_TABLES4;
+ echo CHILD2_1_CREATE_TABLES3;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES;
+ eval $CHILD2_1_DROP_TABLES6;
+ eval $CHILD2_1_DROP_TABLES4;
+ eval $CHILD2_1_DROP_TABLES3;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES;
+ eval $CHILD2_1_CREATE_TABLES6;
+ eval $CHILD2_1_CREATE_TABLES4;
+ eval $CHILD2_1_CREATE_TABLES3;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS tbl_a;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_a (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+echo CREATE TABLE tbl_b (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1;
+eval CREATE TABLE tbl_b (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1;
+echo CREATE TABLE tbl_c (
+ a INT AUTO_INCREMENT,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b),
+ KEY idx2(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1;
+eval CREATE TABLE tbl_c (
+ a INT AUTO_INCREMENT,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b),
+ KEY idx2(c)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT3_2_1;
+echo CREATE TABLE tbl_d (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1;
+eval CREATE TABLE tbl_d (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1;
+--enable_query_log
+insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02');
+insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03');
+insert into tbl_c values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04');
+insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+
+--echo
+--echo select test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--connection master_1
+SELECT a.a, c.b, c.c, d.a FROM tbl_d a left join tbl_c b on a.a = b.a left join tbl_b c on b.c = c.c left join tbl_a d on c.b = d.b ORDER BY a.a DESC;
+
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ eval $CHILD2_1_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ if ($USE_GENERAL_LOG)
+ {
+ SET GLOBAL log_output = @old_log_output;
+ }
+}
+--enable_warnings
+--source ../include/direct_left_join_nullable_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/t/direct_left_right_join_nullable.test b/storage/spider/mysql-test/spider/t/direct_left_right_join_nullable.test
new file mode 100644
index 00000000000..9d5a990e0ba
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/direct_left_right_join_nullable.test
@@ -0,0 +1,212 @@
+--source ../include/direct_left_right_join_nullable_init.inc
+
+--echo
+--echo drop and create databases
+--connection master_1
+--disable_warnings
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SET @old_log_output = @@global.log_output;
+ SET GLOBAL log_output = 'TABLE,FILE';
+ }
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo create table and insert
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES;
+ echo CHILD2_1_DROP_TABLES6;
+ echo CHILD2_1_DROP_TABLES4;
+ echo CHILD2_1_DROP_TABLES3;
+ echo CHILD2_1_CREATE_TABLES;
+ echo CHILD2_1_CREATE_TABLES6;
+ echo CHILD2_1_CREATE_TABLES4;
+ echo CHILD2_1_CREATE_TABLES3;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES;
+ eval $CHILD2_1_DROP_TABLES6;
+ eval $CHILD2_1_DROP_TABLES4;
+ eval $CHILD2_1_DROP_TABLES3;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES;
+ eval $CHILD2_1_CREATE_TABLES6;
+ eval $CHILD2_1_CREATE_TABLES4;
+ eval $CHILD2_1_CREATE_TABLES3;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS tbl_a;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_a (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+echo CREATE TABLE tbl_b (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1;
+eval CREATE TABLE tbl_b (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1;
+echo CREATE TABLE tbl_c (
+ a INT AUTO_INCREMENT,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b),
+ KEY idx2(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1;
+eval CREATE TABLE tbl_c (
+ a INT AUTO_INCREMENT,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b),
+ KEY idx2(c)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT3_2_1;
+echo CREATE TABLE tbl_d (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1;
+eval CREATE TABLE tbl_d (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1;
+--enable_query_log
+insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02');
+insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03');
+insert into tbl_c values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04');
+insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+
+--echo
+--echo select test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--connection master_1
+SELECT a.a, c.b, c.c, d.a FROM tbl_a a left join tbl_b b on a.a = b.a left join tbl_c c on b.c = c.c right join tbl_d d on c.b = d.b ORDER BY d.a DESC;
+
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ eval $CHILD2_1_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ if ($USE_GENERAL_LOG)
+ {
+ SET GLOBAL log_output = @old_log_output;
+ }
+}
+--enable_warnings
+--source ../include/direct_left_right_join_nullable_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/t/direct_left_right_left_join_nullable.test b/storage/spider/mysql-test/spider/t/direct_left_right_left_join_nullable.test
new file mode 100644
index 00000000000..90e3666957d
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/direct_left_right_left_join_nullable.test
@@ -0,0 +1,212 @@
+--source ../include/direct_left_right_left_join_nullable_init.inc
+
+--echo
+--echo drop and create databases
+--connection master_1
+--disable_warnings
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SET @old_log_output = @@global.log_output;
+ SET GLOBAL log_output = 'TABLE,FILE';
+ }
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo create table and insert
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES;
+ echo CHILD2_1_DROP_TABLES6;
+ echo CHILD2_1_DROP_TABLES4;
+ echo CHILD2_1_DROP_TABLES3;
+ echo CHILD2_1_CREATE_TABLES;
+ echo CHILD2_1_CREATE_TABLES6;
+ echo CHILD2_1_CREATE_TABLES4;
+ echo CHILD2_1_CREATE_TABLES3;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES;
+ eval $CHILD2_1_DROP_TABLES6;
+ eval $CHILD2_1_DROP_TABLES4;
+ eval $CHILD2_1_DROP_TABLES3;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES;
+ eval $CHILD2_1_CREATE_TABLES6;
+ eval $CHILD2_1_CREATE_TABLES4;
+ eval $CHILD2_1_CREATE_TABLES3;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS tbl_a;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_a (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+echo CREATE TABLE tbl_b (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1;
+eval CREATE TABLE tbl_b (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1;
+echo CREATE TABLE tbl_c (
+ a INT AUTO_INCREMENT,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b),
+ KEY idx2(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1;
+eval CREATE TABLE tbl_c (
+ a INT AUTO_INCREMENT,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b),
+ KEY idx2(c)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT3_2_1;
+echo CREATE TABLE tbl_d (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1;
+eval CREATE TABLE tbl_d (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1;
+--enable_query_log
+insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02');
+insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03');
+insert into tbl_c values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04');
+insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+
+--echo
+--echo select test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--connection master_1
+SELECT a.a, c.b, c.c, d.a FROM tbl_a a left join tbl_b b on a.a = b.a right join tbl_c c on b.c = c.c left join tbl_d d on c.b = d.b ORDER BY d.a DESC;
+
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ eval $CHILD2_1_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ if ($USE_GENERAL_LOG)
+ {
+ SET GLOBAL log_output = @old_log_output;
+ }
+}
+--enable_warnings
+--source ../include/direct_left_right_left_join_nullable_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/t/direct_right_join.test b/storage/spider/mysql-test/spider/t/direct_right_join.test
new file mode 100644
index 00000000000..0c0496651d6
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/direct_right_join.test
@@ -0,0 +1,197 @@
+--source ../include/direct_right_join_init.inc
+
+--echo
+--echo drop and create databases
+--connection master_1
+--disable_warnings
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SET @old_log_output = @@global.log_output;
+ SET GLOBAL log_output = 'TABLE,FILE';
+ }
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo create table and insert
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES;
+ echo CHILD2_1_DROP_TABLES6;
+ echo CHILD2_1_DROP_TABLES5;
+ echo CHILD2_1_CREATE_TABLES;
+ echo CHILD2_1_CREATE_TABLES6;
+ echo CHILD2_1_CREATE_TABLES5;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES;
+ eval $CHILD2_1_DROP_TABLES6;
+ eval $CHILD2_1_DROP_TABLES5;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES;
+ eval $CHILD2_1_CREATE_TABLES6;
+ eval $CHILD2_1_CREATE_TABLES5;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS tbl_a;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a),
+ KEY idx1(b)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_a (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ PRIMARY KEY(a),
+ KEY idx1(b)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+echo CREATE TABLE tbl_b (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1;
+eval CREATE TABLE tbl_b (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1;
+echo CREATE TABLE tbl_c (
+ a INT AUTO_INCREMENT,
+ b INT DEFAULT 10,
+ c INT DEFAULT 11,
+ PRIMARY KEY(a),
+ KEY idx1(b),
+ KEY idx2(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1;
+eval CREATE TABLE tbl_c (
+ a INT AUTO_INCREMENT,
+ b INT DEFAULT 10,
+ c INT DEFAULT 11,
+ PRIMARY KEY(a),
+ KEY idx1(b),
+ KEY idx2(c)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1;
+--enable_query_log
+insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+insert into tbl_c values (1,10,100),(2,20,200),(3,30,300),(4,40,400),(5,50,500);
+
+--echo
+--echo select test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--connection master_1
+SELECT a.a, c.b, c.c FROM tbl_a a right join tbl_b b on a.a = b.a right join tbl_c c on a.a = c.a ORDER BY a.b DESC;
+
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ eval $CHILD2_1_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ if ($USE_GENERAL_LOG)
+ {
+ SET GLOBAL log_output = @old_log_output;
+ }
+}
+--enable_warnings
+--source ../include/direct_right_join_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/t/direct_right_join_nullable.test b/storage/spider/mysql-test/spider/t/direct_right_join_nullable.test
new file mode 100644
index 00000000000..3ab4a30ea84
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/direct_right_join_nullable.test
@@ -0,0 +1,212 @@
+--source ../include/direct_right_join_nullable_init.inc
+
+--echo
+--echo drop and create databases
+--connection master_1
+--disable_warnings
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SET @old_log_output = @@global.log_output;
+ SET GLOBAL log_output = 'TABLE,FILE';
+ }
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo create table and insert
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES;
+ echo CHILD2_1_DROP_TABLES6;
+ echo CHILD2_1_DROP_TABLES4;
+ echo CHILD2_1_DROP_TABLES3;
+ echo CHILD2_1_CREATE_TABLES;
+ echo CHILD2_1_CREATE_TABLES6;
+ echo CHILD2_1_CREATE_TABLES4;
+ echo CHILD2_1_CREATE_TABLES3;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES;
+ eval $CHILD2_1_DROP_TABLES6;
+ eval $CHILD2_1_DROP_TABLES4;
+ eval $CHILD2_1_DROP_TABLES3;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES;
+ eval $CHILD2_1_CREATE_TABLES6;
+ eval $CHILD2_1_CREATE_TABLES4;
+ eval $CHILD2_1_CREATE_TABLES3;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS tbl_a;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_a (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+echo CREATE TABLE tbl_b (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1;
+eval CREATE TABLE tbl_b (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1;
+echo CREATE TABLE tbl_c (
+ a INT AUTO_INCREMENT,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b),
+ KEY idx2(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1;
+eval CREATE TABLE tbl_c (
+ a INT AUTO_INCREMENT,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b),
+ KEY idx2(c)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT3_2_1;
+echo CREATE TABLE tbl_d (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1;
+eval CREATE TABLE tbl_d (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1;
+--enable_query_log
+insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02');
+insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03');
+insert into tbl_c values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04');
+insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+
+--echo
+--echo select test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--connection master_1
+SELECT a.a, c.b, c.c, d.a FROM tbl_a a right join tbl_b b on a.a = b.a right join tbl_c c on b.c = c.c right join tbl_d d on c.b = d.b ORDER BY d.a DESC;
+
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ eval $CHILD2_1_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ if ($USE_GENERAL_LOG)
+ {
+ SET GLOBAL log_output = @old_log_output;
+ }
+}
+--enable_warnings
+--source ../include/direct_right_join_nullable_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/t/direct_right_left_join_nullable.test b/storage/spider/mysql-test/spider/t/direct_right_left_join_nullable.test
new file mode 100644
index 00000000000..fefe255890d
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/direct_right_left_join_nullable.test
@@ -0,0 +1,212 @@
+--source ../include/direct_right_left_join_nullable_init.inc
+
+--echo
+--echo drop and create databases
+--connection master_1
+--disable_warnings
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SET @old_log_output = @@global.log_output;
+ SET GLOBAL log_output = 'TABLE,FILE';
+ }
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo create table and insert
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES;
+ echo CHILD2_1_DROP_TABLES6;
+ echo CHILD2_1_DROP_TABLES4;
+ echo CHILD2_1_DROP_TABLES3;
+ echo CHILD2_1_CREATE_TABLES;
+ echo CHILD2_1_CREATE_TABLES6;
+ echo CHILD2_1_CREATE_TABLES4;
+ echo CHILD2_1_CREATE_TABLES3;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES;
+ eval $CHILD2_1_DROP_TABLES6;
+ eval $CHILD2_1_DROP_TABLES4;
+ eval $CHILD2_1_DROP_TABLES3;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES;
+ eval $CHILD2_1_CREATE_TABLES6;
+ eval $CHILD2_1_CREATE_TABLES4;
+ eval $CHILD2_1_CREATE_TABLES3;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS tbl_a;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_a (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+echo CREATE TABLE tbl_b (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1;
+eval CREATE TABLE tbl_b (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1;
+echo CREATE TABLE tbl_c (
+ a INT AUTO_INCREMENT,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b),
+ KEY idx2(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1;
+eval CREATE TABLE tbl_c (
+ a INT AUTO_INCREMENT,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b),
+ KEY idx2(c)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT3_2_1;
+echo CREATE TABLE tbl_d (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1;
+eval CREATE TABLE tbl_d (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1;
+--enable_query_log
+insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02');
+insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03');
+insert into tbl_c values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04');
+insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+
+--echo
+--echo select test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--connection master_1
+SELECT a.a, c.b, c.c, d.a FROM tbl_a a right join tbl_b b on a.a = b.a right join tbl_c c on b.c = c.c left join tbl_d d on c.b = d.b ORDER BY d.a DESC;
+
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ eval $CHILD2_1_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ if ($USE_GENERAL_LOG)
+ {
+ SET GLOBAL log_output = @old_log_output;
+ }
+}
+--enable_warnings
+--source ../include/direct_right_left_join_nullable_deinit.inc
+--echo
+--echo end of test
diff --git a/storage/spider/mysql-test/spider/t/direct_right_left_right_join_nullable.test b/storage/spider/mysql-test/spider/t/direct_right_left_right_join_nullable.test
new file mode 100644
index 00000000000..48882d27939
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/direct_right_left_right_join_nullable.test
@@ -0,0 +1,212 @@
+--source ../include/direct_right_left_right_join_nullable_init.inc
+
+--echo
+--echo drop and create databases
+--connection master_1
+--disable_warnings
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SET @old_log_output = @@global.log_output;
+ SET GLOBAL log_output = 'TABLE,FILE';
+ }
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+}
+--enable_warnings
+
+--echo
+--echo test select 1
+--connection master_1
+SELECT 1;
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ SELECT 1;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo create table and insert
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES;
+ echo CHILD2_1_DROP_TABLES6;
+ echo CHILD2_1_DROP_TABLES4;
+ echo CHILD2_1_DROP_TABLES3;
+ echo CHILD2_1_CREATE_TABLES;
+ echo CHILD2_1_CREATE_TABLES6;
+ echo CHILD2_1_CREATE_TABLES4;
+ echo CHILD2_1_CREATE_TABLES3;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES;
+ eval $CHILD2_1_DROP_TABLES6;
+ eval $CHILD2_1_DROP_TABLES4;
+ eval $CHILD2_1_DROP_TABLES3;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES;
+ eval $CHILD2_1_CREATE_TABLES6;
+ eval $CHILD2_1_CREATE_TABLES4;
+ eval $CHILD2_1_CREATE_TABLES3;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS tbl_a;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE tbl_a (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE tbl_a (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+echo CREATE TABLE tbl_b (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1;
+eval CREATE TABLE tbl_b (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1;
+echo CREATE TABLE tbl_c (
+ a INT AUTO_INCREMENT,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b),
+ KEY idx2(c)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1;
+eval CREATE TABLE tbl_c (
+ a INT AUTO_INCREMENT,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10',
+ KEY idx0(a),
+ KEY idx1(b),
+ KEY idx2(c)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT3_2_1;
+echo CREATE TABLE tbl_d (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1;
+eval CREATE TABLE tbl_d (
+ a INT DEFAULT 10,
+ b CHAR(1) DEFAULT 'c',
+ c DATETIME DEFAULT '1999-10-10 10:10:10'
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1;
+--enable_query_log
+insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02');
+insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03');
+insert into tbl_c values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04');
+insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05');
+
+--echo
+--echo select test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--connection master_1
+SELECT a.a, c.b, c.c, d.a FROM tbl_a a right join tbl_b b on a.a = b.a left join tbl_c c on b.c = c.c right join tbl_d d on c.b = d.b ORDER BY d.a DESC;
+
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ eval $CHILD2_1_SELECT_ARGUMENT1;
+ }
+ eval $CHILD2_1_SELECT_TABLES;
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ if ($USE_GENERAL_LOG)
+ {
+ SET GLOBAL log_output = @old_log_output;
+ }
+}
+--enable_warnings
+--source ../include/direct_right_left_right_join_nullable_deinit.inc
+--echo
+--echo end of test