[FEAT MERGE] merge NLJ/SPF group rescan

This commit is contained in:
obdev
2023-01-12 15:17:04 +00:00
committed by OB-robot
parent 4799992a7f
commit 263a44af96
36 changed files with 3945 additions and 859 deletions

View File

@ -1502,3 +1502,796 @@ drop table t2;
drop table t3;
drop table t4;
set ob_enable_transformation = on;
explain_protocol: 0
drop table if exists t1;
drop table if exists t2;
create table t1 (c1 int primary key, c2 decimal, c3 int, c4 varchar(20)) partition by hash(c1) partitions 2;
create table t2 (c1 int primary key, c2 decimal, c3 int, c4 varchar(20));
insert into t1 (c1, c2, c3, c4) values (1, 1, 1, 'a');
insert into t1 (c1, c2, c3, c4) values (2, 2, null, 'a');
insert into t1 (c1, c2, c3, c4) values (12, 9, null, 'a');
insert into t1 (c1, c2, c3, c4) values (4, 3, null, 'a');
insert into t1 (c1, c2, c3, c4) values (3, 3, null, 'a');
insert into t1 (c1, c2, c3, c4) values (9, 10, null, 'a');
insert into t1 (c1, c2, c3, c4) values (7, 4, null, 'a');
insert into t1 (c1, c2, c3, c4) values (6, 7, null, 'a');
insert into t1 (c1, c2, c3, c4) values (18, 1, null, 'a');
insert into t1 (c1, c2, c3, c4) values (19, 2, null, 'a');
insert into t1 (c1, c2, c3, c4) values (20, 3, null, 'a');
insert into t1 (c1, c2, c3, c4) values (21, 5, null, 'a');
insert into t1 (c1, c2, c3, c4) values (22, 7, null, 'a');
insert into t1 (c1, c2, c3, c4) values (23, 7, null, 'a');
insert into t1 (c1, c2, c3, c4) values (24, 7, null, 'a');
insert into t1 (c1, c2, c3, c4) values (25, 7, null, 'a');
insert into t1 (c1, c2, c3, c4) values (26, 9, null, 'a');
insert into t1 (c1, c2, c3, c4) values (28, 3, null, 'a');
insert into t2 (c1, c2, c3, c4) values (1, 1, 1, 'a');
insert into t2 (c1, c2, c3, c4) values (2, 2, null, 'a');
insert into t2 (c1, c2, c3, c4) values (3, 3, null, 'a');
insert into t2 (c1, c2, c3, c4) values (11, 5, null, 'a');
insert into t2 (c1, c2, c3, c4) values (5, 3, null, 'a');
insert into t2 (c1, c2, c3, c4) values (15, 13, null, 'a');
insert into t2 (c1, c2, c3, c4) values (17, 12, null, 'a');
insert into t2 (c1, c2, c3, c4) values (6, 3, null, 'a');
insert into t2 (c1, c2, c3, c4) values (7, 5, null, 'a');
insert into t2 (c1, c2, c3, c4) values (10, 5, null, 'a');
insert into t2 (c1, c2, c3, c4) values (13, 6, null, 'a');
insert into t2 (c1, c2, c3, c4) values (14, 17, null, 'a');
insert into t2 (c1, c2, c3, c4) values (18, 3, null, 'a');
insert into t2 (c1, c2, c3, c4) values (19, 3, null, 'a');
insert into t2 (c1, c2, c3, c4) values (20, 6, null, 'a');
insert into t2 (c1, c2, c3, c4) values (21, 5, null, 'a');
insert into t2 (c1, c2, c3, c4) values (22, 3, null, 'a');
insert into t2 (c1, c2, c3, c4) values (23, 5, null, 'a');
insert into t2 (c1, c2, c3, c4) values (24, 6, null, 'a');
insert into t2 (c1, c2, c3, c4) values (26, 3, null, 'a');
insert into t2 (c1, c2, c3, c4) values (27, 5, null, 'a');
insert into t2 (c1, c2, c3, c4) values (29, 12, null, 'a');
explain_protocol: 3
EXPLAIN EXTENDED_NOADDR select c1,c1 in (select c1 from t2 where t2.c1 >= t1.c1) as x from t1;
Query Plan
======================================================
|ID|OPERATOR |NAME |EST. ROWS|COST|
------------------------------------------------------
|0 |PX COORDINATOR | |1 |23 |
|1 | EXCHANGE OUT DISTR |:EX10000|1 |22 |
|2 | SUBPLAN FILTER | |1 |22 |
|3 | PX PARTITION ITERATOR | |1 |4 |
|4 | TABLE SCAN |t1 |1 |4 |
|5 | DISTRIBUTED TABLE SCAN|t2 |8 |19 |
======================================================
Outputs & filters:
-------------------------------------
0 - output([INTERNAL_FUNCTION(t1.c1, t1.c1 = ANY(subquery(1)))]), filter(nil), rowset=256
1 - output([INTERNAL_FUNCTION(t1.c1, t1.c1 = ANY(subquery(1)))]), filter(nil), rowset=256, dop=1
2 - output([t1.c1], [t1.c1 = ANY(subquery(1))]), filter(nil), rowset=256,
exec_params_([t1.c1]), onetime_exprs_(nil), init_plan_idxs_(nil), batch_das=true
3 - output([t1.c1]), filter(nil), rowset=256,
force partition granule.
4 - output([t1.c1]), filter(nil), rowset=256,
access([t1.c1]), partitions(p[0-1]),
is_index_back=false,
range_key([t1.c1]), range(MIN ; MAX)always true
5 - output([t2.c1]), filter(nil), rowset=256,
access([GROUP_ID], [t2.c1]), partitions(p0),
is_index_back=false,
range_key([t2.c1]), range(MIN ; MAX)always true,
range_cond([t2.c1 >= ?])
select c1,c1 in (select c1 from t2 where t2.c1 >= t1.c1) as x from t1;
+----+---+
| c1 | x |
+----+---+
| 1 | 1 |
| 2 | 1 |
| 3 | 1 |
| 4 | 0 |
| 6 | 1 |
| 7 | 1 |
| 9 | 0 |
| 12 | 0 |
| 18 | 1 |
| 19 | 1 |
| 20 | 1 |
| 21 | 1 |
| 22 | 1 |
| 23 | 1 |
| 24 | 1 |
| 25 | 0 |
| 26 | 1 |
| 28 | 0 |
+----+---+
EXPLAIN EXTENDED_NOADDR select c1, (select c1 from t2 where t2.c1 >= t1.c1 and t2.c2 > t1.c3 limit 1) as x from t1;
Query Plan
======================================================
|ID|OPERATOR |NAME |EST. ROWS|COST|
------------------------------------------------------
|0 |PX COORDINATOR | |1 |23 |
|1 | EXCHANGE OUT DISTR |:EX10000|1 |23 |
|2 | SUBPLAN FILTER | |1 |22 |
|3 | PX PARTITION ITERATOR | |1 |4 |
|4 | TABLE SCAN |t1 |1 |4 |
|5 | DISTRIBUTED TABLE SCAN|t2 |1 |19 |
======================================================
Outputs & filters:
-------------------------------------
0 - output([INTERNAL_FUNCTION(t1.c1, subquery(1))]), filter(nil), rowset=256
1 - output([INTERNAL_FUNCTION(t1.c1, subquery(1))]), filter(nil), rowset=256, dop=1
2 - output([t1.c1], [subquery(1)]), filter(nil), rowset=256,
exec_params_([t1.c1], [cast(t1.c3, DECIMAL(11, 0))]), onetime_exprs_(nil), init_plan_idxs_(nil), batch_das=true
3 - output([t1.c1], [t1.c3]), filter(nil), rowset=256,
force partition granule.
4 - output([t1.c1], [t1.c3]), filter(nil), rowset=256,
access([t1.c1], [t1.c3]), partitions(p[0-1]),
is_index_back=false,
range_key([t1.c1]), range(MIN ; MAX)always true
5 - output([t2.c1]), filter([t2.c2 > ?]), rowset=256,
access([GROUP_ID], [t2.c1], [t2.c2]), partitions(p0),
limit(1), offset(nil),
is_index_back=false, filter_before_indexback[false],
range_key([t2.c1]), range(MIN ; MAX)always true,
range_cond([t2.c1 >= ?])
select c1, (select c1 from t2 where t2.c1 >= t1.c1 and t2.c2 > t1.c3 limit 1) as x from t1;
+----+---+
| c1 | x |
+----+---+
| 1 | 2 |
| 2 | NULL |
| 3 | NULL |
| 4 | NULL |
| 6 | NULL |
| 7 | NULL |
| 9 | NULL |
| 12 | NULL |
| 18 | NULL |
| 19 | NULL |
| 20 | NULL |
| 21 | NULL |
| 22 | NULL |
| 23 | NULL |
| 24 | NULL |
| 25 | NULL |
| 26 | NULL |
| 28 | NULL |
+----+---+
EXPLAIN EXTENDED_NOADDR select c1,c1 + (select c1 from t2 where t2.c1 = t1.c1) as x from t1;
Query Plan
=====================================================
|ID|OPERATOR |NAME |EST. ROWS|COST|
-----------------------------------------------------
|0 |PX COORDINATOR | |1 |22 |
|1 | EXCHANGE OUT DISTR |:EX10000|1 |22 |
|2 | SUBPLAN FILTER | |1 |22 |
|3 | PX PARTITION ITERATOR| |1 |4 |
|4 | TABLE SCAN |t1 |1 |4 |
|5 | DISTRIBUTED TABLE GET|t2 |1 |18 |
=====================================================
Outputs & filters:
-------------------------------------
0 - output([INTERNAL_FUNCTION(t1.c1, t1.c1 + subquery(1))]), filter(nil), rowset=256
1 - output([INTERNAL_FUNCTION(t1.c1, t1.c1 + subquery(1))]), filter(nil), rowset=256, dop=1
2 - output([t1.c1], [subquery(1)]), filter(nil), rowset=256,
exec_params_([t1.c1]), onetime_exprs_(nil), init_plan_idxs_(nil), batch_das=true
3 - output([t1.c1]), filter(nil), rowset=256,
force partition granule.
4 - output([t1.c1]), filter(nil), rowset=256,
access([t1.c1]), partitions(p[0-1]),
is_index_back=false,
range_key([t1.c1]), range(MIN ; MAX)always true
5 - output([t2.c1]), filter(nil), rowset=256,
access([GROUP_ID], [t2.c1]), partitions(p0),
is_index_back=false,
range_key([t2.c1]), range(MIN ; MAX)always true,
range_cond([t2.c1 = ?])
select c1,c1 + (select c1 from t2 where t2.c1 = t1.c1) as x from t1;
+----+----+
| c1 | x |
+----+----+
| 1 | 2 |
| 2 | 4 |
| 3 | 6 |
| 4 | NULL |
| 6 | 12 |
| 7 | 14 |
| 9 | NULL |
| 12 | NULL |
| 18 | 36 |
| 19 | 38 |
| 20 | 40 |
| 21 | 42 |
| 22 | 44 |
| 23 | 46 |
| 24 | 48 |
| 25 | NULL |
| 26 | 52 |
| 28 | NULL |
+----+----+
EXPLAIN EXTENDED_NOADDR select c1,c1 in (select c1 from t2 where t2.c1 >= t1.c1) and c1 in (select c2 from t2 where t2.c1 >= t1.c1) as x from t1;
Query Plan
======================================================
|ID|OPERATOR |NAME |EST. ROWS|COST|
------------------------------------------------------
|0 |PX COORDINATOR | |1 |41 |
|1 | EXCHANGE OUT DISTR |:EX10000|1 |41 |
|2 | SUBPLAN FILTER | |1 |40 |
|3 | PX PARTITION ITERATOR | |1 |4 |
|4 | TABLE SCAN |t1 |1 |4 |
|5 | DISTRIBUTED TABLE SCAN|t2 |8 |19 |
|6 | DISTRIBUTED TABLE SCAN|t2 |8 |19 |
======================================================
Outputs & filters:
-------------------------------------
0 - output([INTERNAL_FUNCTION(t1.c1, t1.c1 = ANY(subquery(1)) AND cast(t1.c1, DECIMAL(11, 0)) = ANY(subquery(2)))]), filter(nil), rowset=256
1 - output([INTERNAL_FUNCTION(t1.c1, t1.c1 = ANY(subquery(1)) AND cast(t1.c1, DECIMAL(11, 0)) = ANY(subquery(2)))]), filter(nil), rowset=256, dop=1
2 - output([t1.c1], [t1.c1 = ANY(subquery(1))], [cast(t1.c1, DECIMAL(11, 0)) = ANY(subquery(2))]), filter(nil), rowset=256,
exec_params_([t1.c1], [t1.c1]), onetime_exprs_(nil), init_plan_idxs_(nil), batch_das=true
3 - output([t1.c1]), filter(nil), rowset=256,
force partition granule.
4 - output([t1.c1]), filter(nil), rowset=256,
access([t1.c1]), partitions(p[0-1]),
is_index_back=false,
range_key([t1.c1]), range(MIN ; MAX)always true
5 - output([t2.c1]), filter(nil), rowset=256,
access([GROUP_ID], [t2.c1]), partitions(p0),
is_index_back=false,
range_key([t2.c1]), range(MIN ; MAX)always true,
range_cond([t2.c1 >= ?])
6 - output([t2.c2]), filter(nil), rowset=256,
access([GROUP_ID], [t2.c2]), partitions(p0),
is_index_back=false,
range_key([t2.c1]), range(MIN ; MAX)always true,
range_cond([t2.c1 >= ?])
select c1,c1 in (select c1 from t2 where t2.c1 >= t1.c1) and c1 in (select c2 from t2 where t2.c1 >= t1.c1) as x from t1;
+----+------+
| c1 | x |
+----+------+
| 1 | 1 |
| 2 | 1 |
| 3 | 1 |
| 4 | 0 |
| 6 | 1 |
| 7 | 0 |
| 9 | 0 |
| 12 | 0 |
| 18 | 0 |
| 19 | 0 |
| 20 | 0 |
| 21 | 0 |
| 22 | 0 |
| 23 | 0 |
| 24 | 0 |
| 25 | 0 |
| 26 | 0 |
| 28 | 0 |
+----+------+
EXPLAIN EXTENDED_NOADDR select c1,c1 in (select c1 from t2 where t2.c1 >= t1.c1) or c1 in (select c2 from t2 where t2.c1 >= t1.c1) as x from t1;
Query Plan
======================================================
|ID|OPERATOR |NAME |EST. ROWS|COST|
------------------------------------------------------
|0 |PX COORDINATOR | |1 |41 |
|1 | EXCHANGE OUT DISTR |:EX10000|1 |41 |
|2 | SUBPLAN FILTER | |1 |40 |
|3 | PX PARTITION ITERATOR | |1 |4 |
|4 | TABLE SCAN |t1 |1 |4 |
|5 | DISTRIBUTED TABLE SCAN|t2 |8 |19 |
|6 | DISTRIBUTED TABLE SCAN|t2 |8 |19 |
======================================================
Outputs & filters:
-------------------------------------
0 - output([INTERNAL_FUNCTION(t1.c1, t1.c1 = ANY(subquery(1)) OR cast(t1.c1, DECIMAL(11, 0)) = ANY(subquery(2)))]), filter(nil), rowset=256
1 - output([INTERNAL_FUNCTION(t1.c1, t1.c1 = ANY(subquery(1)) OR cast(t1.c1, DECIMAL(11, 0)) = ANY(subquery(2)))]), filter(nil), rowset=256, dop=1
2 - output([t1.c1], [t1.c1 = ANY(subquery(1))], [cast(t1.c1, DECIMAL(11, 0)) = ANY(subquery(2))]), filter(nil), rowset=256,
exec_params_([t1.c1], [t1.c1]), onetime_exprs_(nil), init_plan_idxs_(nil), batch_das=true
3 - output([t1.c1]), filter(nil), rowset=256,
force partition granule.
4 - output([t1.c1]), filter(nil), rowset=256,
access([t1.c1]), partitions(p[0-1]),
is_index_back=false,
range_key([t1.c1]), range(MIN ; MAX)always true
5 - output([t2.c1]), filter(nil), rowset=256,
access([GROUP_ID], [t2.c1]), partitions(p0),
is_index_back=false,
range_key([t2.c1]), range(MIN ; MAX)always true,
range_cond([t2.c1 >= ?])
6 - output([t2.c2]), filter(nil), rowset=256,
access([GROUP_ID], [t2.c2]), partitions(p0),
is_index_back=false,
range_key([t2.c1]), range(MIN ; MAX)always true,
range_cond([t2.c1 >= ?])
select c1,c1 in (select c1 from t2 where t2.c1 >= t1.c1) or c1 in (select c2 from t2 where t2.c1 >= t1.c1) as x from t1;
+----+------+
| c1 | x |
+----+------+
| 1 | 1 |
| 2 | 1 |
| 3 | 1 |
| 4 | 0 |
| 6 | 1 |
| 7 | 1 |
| 9 | 0 |
| 12 | 1 |
| 18 | 1 |
| 19 | 1 |
| 20 | 1 |
| 21 | 1 |
| 22 | 1 |
| 23 | 1 |
| 24 | 1 |
| 25 | 0 |
| 26 | 1 |
| 28 | 0 |
+----+------+
EXPLAIN EXTENDED_NOADDR select c1,c1 in (select c1 from t2 where t2.c1 <= t1.c1) and c1 in (select c2 from t2 where t2.c1 <= t1.c1) as x from t1;
Query Plan
======================================================
|ID|OPERATOR |NAME |EST. ROWS|COST|
------------------------------------------------------
|0 |PX COORDINATOR | |1 |41 |
|1 | EXCHANGE OUT DISTR |:EX10000|1 |41 |
|2 | SUBPLAN FILTER | |1 |40 |
|3 | PX PARTITION ITERATOR | |1 |4 |
|4 | TABLE SCAN |t1 |1 |4 |
|5 | DISTRIBUTED TABLE SCAN|t2 |8 |19 |
|6 | DISTRIBUTED TABLE SCAN|t2 |8 |19 |
======================================================
Outputs & filters:
-------------------------------------
0 - output([INTERNAL_FUNCTION(t1.c1, t1.c1 = ANY(subquery(1)) AND cast(t1.c1, DECIMAL(11, 0)) = ANY(subquery(2)))]), filter(nil), rowset=256
1 - output([INTERNAL_FUNCTION(t1.c1, t1.c1 = ANY(subquery(1)) AND cast(t1.c1, DECIMAL(11, 0)) = ANY(subquery(2)))]), filter(nil), rowset=256, dop=1
2 - output([t1.c1], [t1.c1 = ANY(subquery(1))], [cast(t1.c1, DECIMAL(11, 0)) = ANY(subquery(2))]), filter(nil), rowset=256,
exec_params_([t1.c1], [t1.c1]), onetime_exprs_(nil), init_plan_idxs_(nil), batch_das=true
3 - output([t1.c1]), filter(nil), rowset=256,
force partition granule.
4 - output([t1.c1]), filter(nil), rowset=256,
access([t1.c1]), partitions(p[0-1]),
is_index_back=false,
range_key([t1.c1]), range(MIN ; MAX)always true
5 - output([t2.c1]), filter(nil), rowset=256,
access([GROUP_ID], [t2.c1]), partitions(p0),
is_index_back=false,
range_key([t2.c1]), range(MIN ; MAX)always true,
range_cond([t2.c1 <= ?])
6 - output([t2.c2]), filter(nil), rowset=256,
access([GROUP_ID], [t2.c2]), partitions(p0),
is_index_back=false,
range_key([t2.c1]), range(MIN ; MAX)always true,
range_cond([t2.c1 <= ?])
select c1,c1 in (select c1 from t2 where t2.c1 <= t1.c1) and c1 in (select c2 from t2 where t2.c1 <= t1.c1) as x from t1;
+----+------+
| c1 | x |
+----+------+
| 1 | 1 |
| 2 | 1 |
| 3 | 1 |
| 4 | 0 |
| 6 | 0 |
| 7 | 0 |
| 9 | 0 |
| 12 | 0 |
| 18 | 0 |
| 19 | 0 |
| 20 | 0 |
| 21 | 0 |
| 22 | 0 |
| 23 | 0 |
| 24 | 0 |
| 25 | 0 |
| 26 | 0 |
| 28 | 0 |
+----+------+
EXPLAIN EXTENDED_NOADDR select c1,c1 in (select c1 from t2 where t2.c1 <= t1.c1) or c1 in (select c2 from t2 where t2.c1 <= t1.c1) as x from t1;
Query Plan
======================================================
|ID|OPERATOR |NAME |EST. ROWS|COST|
------------------------------------------------------
|0 |PX COORDINATOR | |1 |41 |
|1 | EXCHANGE OUT DISTR |:EX10000|1 |41 |
|2 | SUBPLAN FILTER | |1 |40 |
|3 | PX PARTITION ITERATOR | |1 |4 |
|4 | TABLE SCAN |t1 |1 |4 |
|5 | DISTRIBUTED TABLE SCAN|t2 |8 |19 |
|6 | DISTRIBUTED TABLE SCAN|t2 |8 |19 |
======================================================
Outputs & filters:
-------------------------------------
0 - output([INTERNAL_FUNCTION(t1.c1, t1.c1 = ANY(subquery(1)) OR cast(t1.c1, DECIMAL(11, 0)) = ANY(subquery(2)))]), filter(nil), rowset=256
1 - output([INTERNAL_FUNCTION(t1.c1, t1.c1 = ANY(subquery(1)) OR cast(t1.c1, DECIMAL(11, 0)) = ANY(subquery(2)))]), filter(nil), rowset=256, dop=1
2 - output([t1.c1], [t1.c1 = ANY(subquery(1))], [cast(t1.c1, DECIMAL(11, 0)) = ANY(subquery(2))]), filter(nil), rowset=256,
exec_params_([t1.c1], [t1.c1]), onetime_exprs_(nil), init_plan_idxs_(nil), batch_das=true
3 - output([t1.c1]), filter(nil), rowset=256,
force partition granule.
4 - output([t1.c1]), filter(nil), rowset=256,
access([t1.c1]), partitions(p[0-1]),
is_index_back=false,
range_key([t1.c1]), range(MIN ; MAX)always true
5 - output([t2.c1]), filter(nil), rowset=256,
access([GROUP_ID], [t2.c1]), partitions(p0),
is_index_back=false,
range_key([t2.c1]), range(MIN ; MAX)always true,
range_cond([t2.c1 <= ?])
6 - output([t2.c2]), filter(nil), rowset=256,
access([GROUP_ID], [t2.c2]), partitions(p0),
is_index_back=false,
range_key([t2.c1]), range(MIN ; MAX)always true,
range_cond([t2.c1 <= ?])
select c1,c1 in (select c1 from t2 where t2.c1 <= t1.c1) or c1 in (select c2 from t2 where t2.c1 <= t1.c1) as x from t1;
+----+------+
| c1 | x |
+----+------+
| 1 | 1 |
| 2 | 1 |
| 3 | 1 |
| 4 | 0 |
| 6 | 1 |
| 7 | 1 |
| 9 | 0 |
| 12 | 0 |
| 18 | 1 |
| 19 | 1 |
| 20 | 1 |
| 21 | 1 |
| 22 | 1 |
| 23 | 1 |
| 24 | 1 |
| 25 | 0 |
| 26 | 1 |
| 28 | 0 |
+----+------+
EXPLAIN EXTENDED_NOADDR select c1,c1 in (select c1 from t2 where t2.c1 <= t1.c1) and c1 in (select c2 from t2 where t2.c1 <= t1.c1) or c1 + (select c1 from t2 where t2.c1 = t1.c1) as x from t1;
Query Plan
======================================================
|ID|OPERATOR |NAME |EST. ROWS|COST|
------------------------------------------------------
|0 |PX COORDINATOR | |1 |59 |
|1 | EXCHANGE OUT DISTR |:EX10000|1 |59 |
|2 | SUBPLAN FILTER | |1 |58 |
|3 | PX PARTITION ITERATOR | |1 |4 |
|4 | TABLE SCAN |t1 |1 |4 |
|5 | DISTRIBUTED TABLE SCAN|t2 |8 |19 |
|6 | DISTRIBUTED TABLE SCAN|t2 |8 |19 |
|7 | DISTRIBUTED TABLE GET |t2 |1 |18 |
======================================================
Outputs & filters:
-------------------------------------
0 - output([INTERNAL_FUNCTION(t1.c1, t1.c1 = ANY(subquery(1)) AND cast(t1.c1, DECIMAL(11, 0)) = ANY(subquery(2)) OR t1.c1 + subquery(3))]), filter(nil), rowset=256
1 - output([INTERNAL_FUNCTION(t1.c1, t1.c1 = ANY(subquery(1)) AND cast(t1.c1, DECIMAL(11, 0)) = ANY(subquery(2)) OR t1.c1 + subquery(3))]), filter(nil), rowset=256, dop=1
2 - output([t1.c1], [t1.c1 = ANY(subquery(1))], [cast(t1.c1, DECIMAL(11, 0)) = ANY(subquery(2))], [subquery(3)]), filter(nil), rowset=256,
exec_params_([t1.c1], [t1.c1], [t1.c1]), onetime_exprs_(nil), init_plan_idxs_(nil), batch_das=true
3 - output([t1.c1]), filter(nil), rowset=256,
force partition granule.
4 - output([t1.c1]), filter(nil), rowset=256,
access([t1.c1]), partitions(p[0-1]),
is_index_back=false,
range_key([t1.c1]), range(MIN ; MAX)always true
5 - output([t2.c1]), filter(nil), rowset=256,
access([GROUP_ID], [t2.c1]), partitions(p0),
is_index_back=false,
range_key([t2.c1]), range(MIN ; MAX)always true,
range_cond([t2.c1 <= ?])
6 - output([t2.c2]), filter(nil), rowset=256,
access([GROUP_ID], [t2.c2]), partitions(p0),
is_index_back=false,
range_key([t2.c1]), range(MIN ; MAX)always true,
range_cond([t2.c1 <= ?])
7 - output([t2.c1]), filter(nil), rowset=256,
access([GROUP_ID], [t2.c1]), partitions(p0),
is_index_back=false,
range_key([t2.c1]), range(MIN ; MAX)always true,
range_cond([t2.c1 = ?])
select c1,c1 in (select c1 from t2 where t2.c1 <= t1.c1) and c1 in (select c2 from t2 where t2.c1 <= t1.c1) or c1 + (select c1 from t2 where t2.c1 = t1.c1) as x from t1;
+----+------+
| c1 | x |
+----+------+
| 1 | 1 |
| 2 | 1 |
| 3 | 1 |
| 4 | NULL |
| 6 | 1 |
| 7 | 1 |
| 9 | NULL |
| 12 | NULL |
| 18 | 1 |
| 19 | 1 |
| 20 | 1 |
| 21 | 1 |
| 22 | 1 |
| 23 | 1 |
| 24 | 1 |
| 25 | NULL |
| 26 | 1 |
| 28 | NULL |
+----+------+
EXPLAIN EXTENDED_NOADDR select c1,c1 in (select c1 from t2 where t2.c1=t1.c1) and c1 in (select c1 from t2 where t2.c1 <= t1.c1) or c1 + (select c1 from t2 where t2.c1 = t1.c1) as x, c1+(select c1 from t2 where t2.c1 = t1.c1) or c1 in (select c2 from t2 where t2.c1 <= t1.c1) as y,c1+(select c2 from t2 where t1.c1=t2.c1) > 10 and c1 in (select c1 from t2 where t1.c1>= t2.c1) as z from t1;
Query Plan
======================================================
|ID|OPERATOR |NAME |EST. ROWS|COST|
------------------------------------------------------
|0 |PX COORDINATOR | |1 |131 |
|1 | EXCHANGE OUT DISTR |:EX10000|1 |131 |
|2 | SUBPLAN FILTER | |1 |130 |
|3 | PX PARTITION ITERATOR | |1 |4 |
|4 | TABLE SCAN |t1 |1 |4 |
|5 | DISTRIBUTED TABLE GET |t2 |1 |18 |
|6 | DISTRIBUTED TABLE SCAN|t2 |8 |19 |
|7 | DISTRIBUTED TABLE GET |t2 |1 |18 |
|8 | DISTRIBUTED TABLE GET |t2 |1 |18 |
|9 | DISTRIBUTED TABLE SCAN|t2 |8 |19 |
|10| DISTRIBUTED TABLE GET |t2 |1 |18 |
|11| DISTRIBUTED TABLE SCAN|t2 |8 |19 |
======================================================
Outputs & filters:
-------------------------------------
0 - output([INTERNAL_FUNCTION(t1.c1, t1.c1 = ANY(subquery(1)) AND t1.c1 = ANY(subquery(2)) OR t1.c1 + subquery(3), t1.c1 + subquery(4) OR cast(t1.c1, DECIMAL(11, 0)) = ANY(subquery(5)), cast(t1.c1, DECIMAL(11, 0)) + subquery(6) > cast(10, DECIMAL(2, 0)) AND t1.c1 = ANY(subquery(7)))]), filter(nil), rowset=256
1 - output([INTERNAL_FUNCTION(t1.c1, t1.c1 = ANY(subquery(1)) AND t1.c1 = ANY(subquery(2)) OR t1.c1 + subquery(3), t1.c1 + subquery(4) OR cast(t1.c1, DECIMAL(11, 0)) = ANY(subquery(5)), cast(t1.c1, DECIMAL(11, 0)) + subquery(6) > cast(10, DECIMAL(2, 0)) AND t1.c1 = ANY(subquery(7)))]), filter(nil), rowset=256, dop=1
2 - output([t1.c1], [t1.c1 = ANY(subquery(1))], [t1.c1 = ANY(subquery(2))], [cast(t1.c1, DECIMAL(11, 0)) = ANY(subquery(5))], [t1.c1 = ANY(subquery(7))], [subquery(3)], [subquery(4)], [subquery(6)]), filter(nil), rowset=256,
exec_params_([t1.c1], [t1.c1], [t1.c1], [t1.c1], [t1.c1], [t1.c1], [t1.c1]), onetime_exprs_(nil), init_plan_idxs_(nil), batch_das=true
3 - output([t1.c1]), filter(nil), rowset=256,
force partition granule.
4 - output([t1.c1]), filter(nil), rowset=256,
access([t1.c1]), partitions(p[0-1]),
is_index_back=false,
range_key([t1.c1]), range(MIN ; MAX)always true
5 - output([t2.c1]), filter(nil), rowset=256,
access([GROUP_ID], [t2.c1]), partitions(p0),
is_index_back=false,
range_key([t2.c1]), range(MIN ; MAX)always true,
range_cond([t2.c1 = ?])
6 - output([t2.c1]), filter(nil), rowset=256,
access([GROUP_ID], [t2.c1]), partitions(p0),
is_index_back=false,
range_key([t2.c1]), range(MIN ; MAX)always true,
range_cond([t2.c1 <= ?])
7 - output([t2.c1]), filter(nil), rowset=256,
access([GROUP_ID], [t2.c1]), partitions(p0),
is_index_back=false,
range_key([t2.c1]), range(MIN ; MAX)always true,
range_cond([t2.c1 = ?])
8 - output([t2.c1]), filter(nil), rowset=256,
access([GROUP_ID], [t2.c1]), partitions(p0),
is_index_back=false,
range_key([t2.c1]), range(MIN ; MAX)always true,
range_cond([t2.c1 = ?])
9 - output([t2.c2]), filter(nil), rowset=256,
access([GROUP_ID], [t2.c2]), partitions(p0),
is_index_back=false,
range_key([t2.c1]), range(MIN ; MAX)always true,
range_cond([t2.c1 <= ?])
10 - output([t2.c2]), filter(nil), rowset=256,
access([GROUP_ID], [t2.c2]), partitions(p0),
is_index_back=false,
range_key([t2.c1]), range(MIN ; MAX)always true,
range_cond([? = t2.c1])
11 - output([t2.c1]), filter(nil), rowset=256,
access([GROUP_ID], [t2.c1]), partitions(p0),
is_index_back=false,
range_key([t2.c1]), range(MIN ; MAX)always true,
range_cond([? >= t2.c1])
select c1,c1 in (select c1 from t2 where t2.c1=t1.c1) and c1 in (select c1 from t2 where t2.c1 <= t1.c1) or c1 + (select c1 from t2 where t2.c1 = t1.c1) as x, c1+(select c1 from t2 where t2.c1 = t1.c1) or c1 in (select c2 from t2 where t2.c1 <= t1.c1) as y,c1+(select c2 from t2 where t1.c1=t2.c1) > 10 and c1 in (select c1 from t2 where t1.c1>= t2.c1) as z from t1;
+----+------+------+------+
| c1 | x | y | z |
+----+------+------+------+
| 1 | 1 | 1 | 0 |
| 2 | 1 | 1 | 0 |
| 3 | 1 | 1 | 0 |
| 4 | NULL | NULL | 0 |
| 6 | 1 | 1 | 0 |
| 7 | 1 | 1 | 1 |
| 9 | NULL | NULL | 0 |
| 12 | NULL | NULL | 0 |
| 18 | 1 | 1 | 1 |
| 19 | 1 | 1 | 1 |
| 20 | 1 | 1 | 1 |
| 21 | 1 | 1 | 1 |
| 22 | 1 | 1 | 1 |
| 23 | 1 | 1 | 1 |
| 24 | 1 | 1 | 1 |
| 25 | NULL | NULL | 0 |
| 26 | 1 | 1 | 1 |
| 28 | NULL | NULL | 0 |
+----+------+------+------+
EXPLAIN EXTENDED_NOADDR select c1,c1 in (select c1 from t2 where t2.c1>=t1.c1) and c1 in (select c1 from t2 where t2.c1 <= t1.c1) or c1 + (select c1 from t2 where t2.c1 = t1.c1) as x, c1+(select c1 from t2 where t2.c1 = t1.c1) > 30 or c1 in (select c2 from t2 where t2.c1 <= t1.c1) as y,c1+(select c2 from t2 where t1.c1=t2.c1) > 10 and c1 in (select c1 from t2 where t1.c1>= t2.c1) as z from t1;
Query Plan
======================================================
|ID|OPERATOR |NAME |EST. ROWS|COST|
------------------------------------------------------
|0 |PX COORDINATOR | |1 |131 |
|1 | EXCHANGE OUT DISTR |:EX10000|1 |131 |
|2 | SUBPLAN FILTER | |1 |131 |
|3 | PX PARTITION ITERATOR | |1 |4 |
|4 | TABLE SCAN |t1 |1 |4 |
|5 | DISTRIBUTED TABLE SCAN|t2 |8 |19 |
|6 | DISTRIBUTED TABLE SCAN|t2 |8 |19 |
|7 | DISTRIBUTED TABLE GET |t2 |1 |18 |
|8 | DISTRIBUTED TABLE GET |t2 |1 |18 |
|9 | DISTRIBUTED TABLE SCAN|t2 |8 |19 |
|10| DISTRIBUTED TABLE GET |t2 |1 |18 |
|11| DISTRIBUTED TABLE SCAN|t2 |8 |19 |
======================================================
Outputs & filters:
-------------------------------------
0 - output([INTERNAL_FUNCTION(t1.c1, t1.c1 = ANY(subquery(1)) AND t1.c1 = ANY(subquery(2)) OR t1.c1 + subquery(3), t1.c1 + subquery(4) > 30 OR cast(t1.c1, DECIMAL(11, 0)) = ANY(subquery(5)), cast(t1.c1, DECIMAL(11, 0)) + subquery(6) > cast(10, DECIMAL(2, 0)) AND t1.c1 = ANY(subquery(7)))]), filter(nil), rowset=256
1 - output([INTERNAL_FUNCTION(t1.c1, t1.c1 = ANY(subquery(1)) AND t1.c1 = ANY(subquery(2)) OR t1.c1 + subquery(3), t1.c1 + subquery(4) > 30 OR cast(t1.c1, DECIMAL(11, 0)) = ANY(subquery(5)), cast(t1.c1, DECIMAL(11, 0)) + subquery(6) > cast(10, DECIMAL(2, 0)) AND t1.c1 = ANY(subquery(7)))]), filter(nil), rowset=256, dop=1
2 - output([t1.c1], [t1.c1 = ANY(subquery(1))], [t1.c1 = ANY(subquery(2))], [cast(t1.c1, DECIMAL(11, 0)) = ANY(subquery(5))], [t1.c1 = ANY(subquery(7))], [subquery(3)], [subquery(4)], [subquery(6)]), filter(nil), rowset=256,
exec_params_([t1.c1], [t1.c1], [t1.c1], [t1.c1], [t1.c1], [t1.c1], [t1.c1]), onetime_exprs_(nil), init_plan_idxs_(nil), batch_das=true
3 - output([t1.c1]), filter(nil), rowset=256,
force partition granule.
4 - output([t1.c1]), filter(nil), rowset=256,
access([t1.c1]), partitions(p[0-1]),
is_index_back=false,
range_key([t1.c1]), range(MIN ; MAX)always true
5 - output([t2.c1]), filter(nil), rowset=256,
access([GROUP_ID], [t2.c1]), partitions(p0),
is_index_back=false,
range_key([t2.c1]), range(MIN ; MAX)always true,
range_cond([t2.c1 >= ?])
6 - output([t2.c1]), filter(nil), rowset=256,
access([GROUP_ID], [t2.c1]), partitions(p0),
is_index_back=false,
range_key([t2.c1]), range(MIN ; MAX)always true,
range_cond([t2.c1 <= ?])
7 - output([t2.c1]), filter(nil), rowset=256,
access([GROUP_ID], [t2.c1]), partitions(p0),
is_index_back=false,
range_key([t2.c1]), range(MIN ; MAX)always true,
range_cond([t2.c1 = ?])
8 - output([t2.c1]), filter(nil), rowset=256,
access([GROUP_ID], [t2.c1]), partitions(p0),
is_index_back=false,
range_key([t2.c1]), range(MIN ; MAX)always true,
range_cond([t2.c1 = ?])
9 - output([t2.c2]), filter(nil), rowset=256,
access([GROUP_ID], [t2.c2]), partitions(p0),
is_index_back=false,
range_key([t2.c1]), range(MIN ; MAX)always true,
range_cond([t2.c1 <= ?])
10 - output([t2.c2]), filter(nil), rowset=256,
access([GROUP_ID], [t2.c2]), partitions(p0),
is_index_back=false,
range_key([t2.c1]), range(MIN ; MAX)always true,
range_cond([? = t2.c1])
11 - output([t2.c1]), filter(nil), rowset=256,
access([GROUP_ID], [t2.c1]), partitions(p0),
is_index_back=false,
range_key([t2.c1]), range(MIN ; MAX)always true,
range_cond([? >= t2.c1])
select c1,c1 in (select c1 from t2 where t2.c1>=t1.c1) and c1 in (select c1 from t2 where t2.c1 <= t1.c1) or c1 + (select c1 from t2 where t2.c1 = t1.c1) as x, c1+(select c1 from t2 where t2.c1 = t1.c1) > 30 or c1 in (select c2 from t2 where t2.c1 <= t1.c1) as y,c1+(select c2 from t2 where t1.c1=t2.c1) > 10 and c1 in (select c1 from t2 where t1.c1>= t2.c1) as z from t1;
+----+------+------+------+
| c1 | x | y | z |
+----+------+------+------+
| 1 | 1 | 1 | 0 |
| 2 | 1 | 1 | 0 |
| 3 | 1 | 1 | 0 |
| 4 | NULL | NULL | 0 |
| 6 | 1 | 0 | 0 |
| 7 | 1 | 0 | 1 |
| 9 | NULL | NULL | 0 |
| 12 | NULL | NULL | 0 |
| 18 | 1 | 1 | 1 |
| 19 | 1 | 1 | 1 |
| 20 | 1 | 1 | 1 |
| 21 | 1 | 1 | 1 |
| 22 | 1 | 1 | 1 |
| 23 | 1 | 1 | 1 |
| 24 | 1 | 1 | 1 |
| 25 | NULL | NULL | 0 |
| 26 | 1 | 1 | 1 |
| 28 | NULL | NULL | 0 |
+----+------+------+------+
EXPLAIN EXTENDED_NOADDR select c1,c1 in (select c1 from t2 where t2.c1>=t1.c1) and c1 in (select c1 from t2 where t2.c1 <= t1.c1) or c1 + (select c1 from t2 where t2.c1 = t1.c1) as x, c1+(select c1 from t2 where t2.c1 = t1.c1) > 30 or c1 in (select c2 from t2 where t2.c1 <= t1.c1) as y,c1+(select c2 from t2 where t1.c1=t2.c1) > 10 and c1 in (select c1 from t2 where t1.c1>= t2.c1) as z from t1;
Query Plan
======================================================
|ID|OPERATOR |NAME |EST. ROWS|COST|
------------------------------------------------------
|0 |PX COORDINATOR | |1 |131 |
|1 | EXCHANGE OUT DISTR |:EX10000|1 |131 |
|2 | SUBPLAN FILTER | |1 |131 |
|3 | PX PARTITION ITERATOR | |1 |4 |
|4 | TABLE SCAN |t1 |1 |4 |
|5 | DISTRIBUTED TABLE SCAN|t2 |8 |19 |
|6 | DISTRIBUTED TABLE SCAN|t2 |8 |19 |
|7 | DISTRIBUTED TABLE GET |t2 |1 |18 |
|8 | DISTRIBUTED TABLE GET |t2 |1 |18 |
|9 | DISTRIBUTED TABLE SCAN|t2 |8 |19 |
|10| DISTRIBUTED TABLE GET |t2 |1 |18 |
|11| DISTRIBUTED TABLE SCAN|t2 |8 |19 |
======================================================
Outputs & filters:
-------------------------------------
0 - output([INTERNAL_FUNCTION(t1.c1, t1.c1 = ANY(subquery(1)) AND t1.c1 = ANY(subquery(2)) OR t1.c1 + subquery(3), t1.c1 + subquery(4) > 30 OR cast(t1.c1, DECIMAL(11, 0)) = ANY(subquery(5)), cast(t1.c1, DECIMAL(11, 0)) + subquery(6) > cast(10, DECIMAL(2, 0)) AND t1.c1 = ANY(subquery(7)))]), filter(nil), rowset=256
1 - output([INTERNAL_FUNCTION(t1.c1, t1.c1 = ANY(subquery(1)) AND t1.c1 = ANY(subquery(2)) OR t1.c1 + subquery(3), t1.c1 + subquery(4) > 30 OR cast(t1.c1, DECIMAL(11, 0)) = ANY(subquery(5)), cast(t1.c1, DECIMAL(11, 0)) + subquery(6) > cast(10, DECIMAL(2, 0)) AND t1.c1 = ANY(subquery(7)))]), filter(nil), rowset=256, dop=1
2 - output([t1.c1], [t1.c1 = ANY(subquery(1))], [t1.c1 = ANY(subquery(2))], [cast(t1.c1, DECIMAL(11, 0)) = ANY(subquery(5))], [t1.c1 = ANY(subquery(7))], [subquery(3)], [subquery(4)], [subquery(6)]), filter(nil), rowset=256,
exec_params_([t1.c1], [t1.c1], [t1.c1], [t1.c1], [t1.c1], [t1.c1], [t1.c1]), onetime_exprs_(nil), init_plan_idxs_(nil), batch_das=true
3 - output([t1.c1]), filter(nil), rowset=256,
force partition granule.
4 - output([t1.c1]), filter(nil), rowset=256,
access([t1.c1]), partitions(p[0-1]),
is_index_back=false,
range_key([t1.c1]), range(MIN ; MAX)always true
5 - output([t2.c1]), filter(nil), rowset=256,
access([GROUP_ID], [t2.c1]), partitions(p0),
is_index_back=false,
range_key([t2.c1]), range(MIN ; MAX)always true,
range_cond([t2.c1 >= ?])
6 - output([t2.c1]), filter(nil), rowset=256,
access([GROUP_ID], [t2.c1]), partitions(p0),
is_index_back=false,
range_key([t2.c1]), range(MIN ; MAX)always true,
range_cond([t2.c1 <= ?])
7 - output([t2.c1]), filter(nil), rowset=256,
access([GROUP_ID], [t2.c1]), partitions(p0),
is_index_back=false,
range_key([t2.c1]), range(MIN ; MAX)always true,
range_cond([t2.c1 = ?])
8 - output([t2.c1]), filter(nil), rowset=256,
access([GROUP_ID], [t2.c1]), partitions(p0),
is_index_back=false,
range_key([t2.c1]), range(MIN ; MAX)always true,
range_cond([t2.c1 = ?])
9 - output([t2.c2]), filter(nil), rowset=256,
access([GROUP_ID], [t2.c2]), partitions(p0),
is_index_back=false,
range_key([t2.c1]), range(MIN ; MAX)always true,
range_cond([t2.c1 <= ?])
10 - output([t2.c2]), filter(nil), rowset=256,
access([GROUP_ID], [t2.c2]), partitions(p0),
is_index_back=false,
range_key([t2.c1]), range(MIN ; MAX)always true,
range_cond([? = t2.c1])
11 - output([t2.c1]), filter(nil), rowset=256,
access([GROUP_ID], [t2.c1]), partitions(p0),
is_index_back=false,
range_key([t2.c1]), range(MIN ; MAX)always true,
range_cond([? >= t2.c1])
select c1,c1 in (select c1 from t2 where t2.c1>=t1.c1) and c1 in (select c1 from t2 where t2.c1 <= t1.c1) or c1 + (select c1 from t2 where t2.c1 = t1.c1) as x, c1+(select c1 from t2 where t2.c1 = t1.c1) > 30 or c1 in (select c2 from t2 where t2.c1 <= t1.c1) as y,c1+(select c2 from t2 where t1.c1=t2.c1) > 10 and c1 in (select c1 from t2 where t1.c1>= t2.c1) as z from t1;
+----+------+------+------+
| c1 | x | y | z |
+----+------+------+------+
| 1 | 1 | 1 | 0 |
| 2 | 1 | 1 | 0 |
| 3 | 1 | 1 | 0 |
| 4 | NULL | NULL | 0 |
| 6 | 1 | 0 | 0 |
| 7 | 1 | 0 | 1 |
| 9 | NULL | NULL | 0 |
| 12 | NULL | NULL | 0 |
| 18 | 1 | 1 | 1 |
| 19 | 1 | 1 | 1 |
| 20 | 1 | 1 | 1 |
| 21 | 1 | 1 | 1 |
| 22 | 1 | 1 | 1 |
| 23 | 1 | 1 | 1 |
| 24 | 1 | 1 | 1 |
| 25 | NULL | NULL | 0 |
| 26 | 1 | 1 | 1 |
| 28 | NULL | NULL | 0 |
+----+------+------+------+

View File

@ -214,3 +214,79 @@ drop table t4;
set ob_enable_transformation = on;
connection syscon;
--sleep 2
--enable_sorted_result
--explain_protocol 0
--disable_warnings
drop table if exists t1;
drop table if exists t2;
--enable_warnings
create table t1 (c1 int primary key, c2 decimal, c3 int, c4 varchar(20)) partition by hash(c1) partitions 2;
create table t2 (c1 int primary key, c2 decimal, c3 int, c4 varchar(20));
insert into t1 (c1, c2, c3, c4) values (1, 1, 1, 'a');
insert into t1 (c1, c2, c3, c4) values (2, 2, null, 'a');
insert into t1 (c1, c2, c3, c4) values (12, 9, null, 'a');
insert into t1 (c1, c2, c3, c4) values (4, 3, null, 'a');
insert into t1 (c1, c2, c3, c4) values (3, 3, null, 'a');
insert into t1 (c1, c2, c3, c4) values (9, 10, null, 'a');
insert into t1 (c1, c2, c3, c4) values (7, 4, null, 'a');
insert into t1 (c1, c2, c3, c4) values (6, 7, null, 'a');
insert into t1 (c1, c2, c3, c4) values (18, 1, null, 'a');
insert into t1 (c1, c2, c3, c4) values (19, 2, null, 'a');
insert into t1 (c1, c2, c3, c4) values (20, 3, null, 'a');
insert into t1 (c1, c2, c3, c4) values (21, 5, null, 'a');
insert into t1 (c1, c2, c3, c4) values (22, 7, null, 'a');
insert into t1 (c1, c2, c3, c4) values (23, 7, null, 'a');
insert into t1 (c1, c2, c3, c4) values (24, 7, null, 'a');
insert into t1 (c1, c2, c3, c4) values (25, 7, null, 'a');
insert into t1 (c1, c2, c3, c4) values (26, 9, null, 'a');
insert into t1 (c1, c2, c3, c4) values (28, 3, null, 'a');
insert into t2 (c1, c2, c3, c4) values (1, 1, 1, 'a');
insert into t2 (c1, c2, c3, c4) values (2, 2, null, 'a');
insert into t2 (c1, c2, c3, c4) values (3, 3, null, 'a');
insert into t2 (c1, c2, c3, c4) values (11, 5, null, 'a');
insert into t2 (c1, c2, c3, c4) values (5, 3, null, 'a');
insert into t2 (c1, c2, c3, c4) values (15, 13, null, 'a');
insert into t2 (c1, c2, c3, c4) values (17, 12, null, 'a');
insert into t2 (c1, c2, c3, c4) values (6, 3, null, 'a');
insert into t2 (c1, c2, c3, c4) values (7, 5, null, 'a');
insert into t2 (c1, c2, c3, c4) values (10, 5, null, 'a');
insert into t2 (c1, c2, c3, c4) values (13, 6, null, 'a');
insert into t2 (c1, c2, c3, c4) values (14, 17, null, 'a');
insert into t2 (c1, c2, c3, c4) values (18, 3, null, 'a');
insert into t2 (c1, c2, c3, c4) values (19, 3, null, 'a');
insert into t2 (c1, c2, c3, c4) values (20, 6, null, 'a');
insert into t2 (c1, c2, c3, c4) values (21, 5, null, 'a');
insert into t2 (c1, c2, c3, c4) values (22, 3, null, 'a');
insert into t2 (c1, c2, c3, c4) values (23, 5, null, 'a');
insert into t2 (c1, c2, c3, c4) values (24, 6, null, 'a');
insert into t2 (c1, c2, c3, c4) values (26, 3, null, 'a');
insert into t2 (c1, c2, c3, c4) values (27, 5, null, 'a');
insert into t2 (c1, c2, c3, c4) values (29, 12, null, 'a');
--explain_protocol 3
select c1,c1 in (select c1 from t2 where t2.c1 >= t1.c1) as x from t1;
#https://work.aone.alibaba-inc.com/issue/47201028
select c1, (select c1 from t2 where t2.c1 >= t1.c1 and t2.c2 > t1.c3 limit 1) as x from t1;
select c1,c1 + (select c1 from t2 where t2.c1 = t1.c1) as x from t1;
select c1,c1 in (select c1 from t2 where t2.c1 >= t1.c1) and c1 in (select c2 from t2 where t2.c1 >= t1.c1) as x from t1;
select c1,c1 in (select c1 from t2 where t2.c1 >= t1.c1) or c1 in (select c2 from t2 where t2.c1 >= t1.c1) as x from t1;
select c1,c1 in (select c1 from t2 where t2.c1 <= t1.c1) and c1 in (select c2 from t2 where t2.c1 <= t1.c1) as x from t1;
select c1,c1 in (select c1 from t2 where t2.c1 <= t1.c1) or c1 in (select c2 from t2 where t2.c1 <= t1.c1) as x from t1;
select c1,c1 in (select c1 from t2 where t2.c1 <= t1.c1) and c1 in (select c2 from t2 where t2.c1 <= t1.c1) or c1 + (select c1 from t2 where t2.c1 = t1.c1) as x from t1;
select c1,c1 in (select c1 from t2 where t2.c1=t1.c1) and c1 in (select c1 from t2 where t2.c1 <= t1.c1) or c1 + (select c1 from t2 where t2.c1 = t1.c1) as x, c1+(select c1 from t2 where t2.c1 = t1.c1) or c1 in (select c2 from t2 where t2.c1 <= t1.c1) as y,c1+(select c2 from t2 where t1.c1=t2.c1) > 10 and c1 in (select c1 from t2 where t1.c1>= t2.c1) as z from t1;
select c1,c1 in (select c1 from t2 where t2.c1>=t1.c1) and c1 in (select c1 from t2 where t2.c1 <= t1.c1) or c1 + (select c1 from t2 where t2.c1 = t1.c1) as x, c1+(select c1 from t2 where t2.c1 = t1.c1) > 30 or c1 in (select c2 from t2 where t2.c1 <= t1.c1) as y,c1+(select c2 from t2 where t1.c1=t2.c1) > 10 and c1 in (select c1 from t2 where t1.c1>= t2.c1) as z from t1;
select c1,c1 in (select c1 from t2 where t2.c1>=t1.c1) and c1 in (select c1 from t2 where t2.c1 <= t1.c1) or c1 + (select c1 from t2 where t2.c1 = t1.c1) as x, c1+(select c1 from t2 where t2.c1 = t1.c1) > 30 or c1 in (select c2 from t2 where t2.c1 <= t1.c1) as y,c1+(select c2 from t2 where t1.c1=t2.c1) > 10 and c1 in (select c1 from t2 where t1.c1>= t2.c1) as z from t1;