[fix](nereids) unstable regression case in nereids_syntax_p0 (#15896)

This commit is contained in:
minghong
2023-01-14 22:37:30 +08:00
committed by GitHub
parent 29863112a4
commit a65044dbac
2 changed files with 45 additions and 36 deletions

View File

@ -129,15 +129,15 @@ suite("join") {
"""
sql """
drop table if exists outerjoin_A;
drop table if exists outerjoin_A_join;
"""
sql """
drop table if exists outerjoin_B;
drop table if exists outerjoin_B_join;
"""
sql """
drop table if exists outerjoin_C;
drop table if exists outerjoin_C_join;
"""
sql """
@ -145,7 +145,7 @@ suite("join") {
"""
sql """
create table if not exists outerjoin_A ( a int not null )
create table if not exists outerjoin_A_join ( a int not null )
ENGINE=OLAP
DISTRIBUTED BY HASH(a) BUCKETS 1
PROPERTIES (
@ -156,7 +156,7 @@ suite("join") {
"""
sql """
create table if not exists outerjoin_B ( a int not null )
create table if not exists outerjoin_B_join ( a int not null )
ENGINE=OLAP
DISTRIBUTED BY HASH(a) BUCKETS 1
PROPERTIES (
@ -167,7 +167,7 @@ suite("join") {
"""
sql """
create table if not exists outerjoin_C ( a int not null )
create table if not exists outerjoin_C_join ( a int not null )
ENGINE=OLAP
DISTRIBUTED BY HASH(a) BUCKETS 1
PROPERTIES (
@ -189,15 +189,15 @@ suite("join") {
"""
sql """
insert into outerjoin_A values( 1 );
insert into outerjoin_A_join values( 1 );
"""
sql """
insert into outerjoin_B values( 1 );
insert into outerjoin_B_join values( 1 );
"""
sql """
insert into outerjoin_C values( 1 );
insert into outerjoin_C_join values( 1 );
"""
sql """
@ -205,12 +205,12 @@ suite("join") {
"""
explain {
sql("select count(*) from outerjoin_A A left join outerjoin_B B on A.a = B.a where B.a in (select a from outerjoin_C);")
sql("select count(*) from outerjoin_A_join A left join outerjoin_B_join B on A.a = B.a where B.a in (select a from outerjoin_C_join);")
contains "INNER JOIN"
}
explain {
sql("""SELECT count(1)
def explainStr =
sql(""" explain SELECT count(1)
FROM
(SELECT sub1.wtid,
count(*)
@ -224,9 +224,18 @@ suite("join") {
FROM test_table_a a ) sub2
ON sub1.wtid = sub2.wtid
AND sub1.wfid = sub2.wfid
GROUP BY sub1.wtid ) qqqq;""")
contains "4:VAGGREGATE (update serialize)"
contains "6:VAGGREGATE (merge finalize)"
}
GROUP BY sub1.wtid ) qqqq;""").toString()
logger.info(explainStr)
assertTrue(
//if analyze finished
explainStr.contains("4:VAGGREGATE (update serialize)")
&& explainStr.contains("6:VAGGREGATE (merge finalize)")
||
//analyze not finished
explainStr.contains("7:VAGGREGATE (update finalize)")
&& explainStr.contains("5:VAGGREGATE (update finalize)")
&& explainStr.contains("4:VEXCHANGE")
&& explainStr.contains("3:VHASH JOIN")
)
}

View File

@ -19,9 +19,9 @@ suite("join_order") {
sql 'set enable_nereids_planner=true'
sql 'set enable_fallback_to_original_planner=false'
sql """ drop table if exists outerjoin_A;"""
sql """ drop table if exists outerjoin_A_order;"""
sql """
create table outerjoin_A ( a1 bigint not null, a2 bigint not null )
create table outerjoin_A_order ( a1 bigint not null, a2 bigint not null )
ENGINE=OLAP
DISTRIBUTED BY HASH(a1) BUCKETS 1
PROPERTIES (
@ -30,9 +30,9 @@ suite("join_order") {
"storage_format" = "V2"
);
"""
sql """ drop table if exists outerjoin_B;"""
sql """ drop table if exists outerjoin_B_order;"""
sql """
create table outerjoin_B ( b int not null )
create table outerjoin_B_order ( b int not null )
ENGINE=OLAP
DISTRIBUTED BY HASH(b) BUCKETS 1
PROPERTIES (
@ -41,9 +41,9 @@ suite("join_order") {
"storage_format" = "V2"
);
"""
sql """ drop table if exists outerjoin_C;"""
sql """ drop table if exists outerjoin_C_order;"""
sql """
create table outerjoin_C ( c int not null )
create table outerjoin_C_order ( c int not null )
ENGINE=OLAP
DISTRIBUTED BY HASH(c) BUCKETS 1
PROPERTIES (
@ -52,9 +52,9 @@ suite("join_order") {
"storage_format" = "V2"
);
"""
sql """ drop table if exists outerjoin_D;"""
sql """ drop table if exists outerjoin_D_order;"""
sql """
create table outerjoin_D ( d1 int not null, d2 int not null, d3 int not null )
create table outerjoin_D_order ( d1 int not null, d2 int not null, d3 int not null )
ENGINE=OLAP
DISTRIBUTED BY HASH(d1) BUCKETS 1
PROPERTIES (
@ -63,9 +63,9 @@ suite("join_order") {
"storage_format" = "V2"
);
"""
sql """ drop table if exists outerjoin_E;"""
sql """ drop table if exists outerjoin_E_order;"""
sql """
create table outerjoin_E ( e1 int not null, e2 int not null )
create table outerjoin_E_order ( e1 int not null, e2 int not null )
ENGINE=OLAP
DISTRIBUTED BY HASH(e1) BUCKETS 1
PROPERTIES (
@ -75,21 +75,21 @@ suite("join_order") {
);
"""
sql """insert into outerjoin_A values( 1,2 );"""
sql """insert into outerjoin_B values( 1 );"""
sql """insert into outerjoin_C values( 1 );"""
sql """insert into outerjoin_D values( 1,2,3 );"""
sql """insert into outerjoin_E values( 1,2 );"""
sql """insert into outerjoin_A_order values( 1,2 );"""
sql """insert into outerjoin_B_order values( 1 );"""
sql """insert into outerjoin_C_order values( 1 );"""
sql """insert into outerjoin_D_order values( 1,2,3 );"""
sql """insert into outerjoin_E_order values( 1,2 );"""
qt_sql"""SELECT count(*)
FROM outerjoin_A t1
LEFT JOIN outerjoin_D dcbc
FROM outerjoin_A_order t1
LEFT JOIN outerjoin_D_order dcbc
ON t1.a1 = dcbc.d1
LEFT JOIN outerjoin_C dcso
LEFT JOIN outerjoin_C_order dcso
ON dcbc.d2 = dcso.c
LEFT JOIN outerjoin_B dcii
LEFT JOIN outerjoin_B_order dcii
ON t1.a2 = dcii.b
LEFT JOIN outerjoin_E dcssm
LEFT JOIN outerjoin_E_order dcssm
ON dcii.b = dcssm.e1
AND dcbc.d3 = dcssm.e2;
"""