[fix](Nereids) fix unstable regression test cases and some bugs (#19999)
Fix bugs: 1. should return the other side child of Or if current side is NULL after constant fold 2. Lead should has three parameters, remove the default value ctors Not enable Nereids case under nereids_p0 1. nereids_p0/join/sql 2. nereids_p0/sql_functions/horology_functions/sql Should disble Nereids explicitly because the result is not same 1. query_p0/sql_functions/horology_functions/sql 2. query_p0/stats/query_stats_test.groovy 3. query_profile/test_profile.groovy Unstable regression test case 1. nereids_syntax_p0/join.groovy
This commit is contained in:
@ -240,18 +240,23 @@ public class FoldConstantRuleOnFE extends AbstractExpressionRewriteRule {
|
||||
@Override
|
||||
public Expression visitOr(Or or, ExpressionRewriteContext context) {
|
||||
List<Expression> nonFalseLiteral = Lists.newArrayList();
|
||||
boolean hasNull = false;
|
||||
for (Expression e : or.children()) {
|
||||
e = e.accept(this, context);
|
||||
if (BooleanLiteral.TRUE.equals(e)) {
|
||||
return BooleanLiteral.TRUE;
|
||||
} else if (e instanceof NullLiteral) {
|
||||
return e;
|
||||
hasNull = true;
|
||||
} else if (!BooleanLiteral.FALSE.equals(e)) {
|
||||
nonFalseLiteral.add(e);
|
||||
}
|
||||
}
|
||||
if (nonFalseLiteral.isEmpty()) {
|
||||
return BooleanLiteral.FALSE;
|
||||
if (hasNull) {
|
||||
return new NullLiteral(BooleanType.INSTANCE);
|
||||
} else {
|
||||
return BooleanLiteral.FALSE;
|
||||
}
|
||||
}
|
||||
if (nonFalseLiteral.size() == 1) {
|
||||
return nonFalseLiteral.get(0);
|
||||
|
||||
@ -21,7 +21,6 @@ import org.apache.doris.catalog.FunctionSignature;
|
||||
import org.apache.doris.nereids.exceptions.AnalysisException;
|
||||
import org.apache.doris.nereids.trees.expressions.Expression;
|
||||
import org.apache.doris.nereids.trees.expressions.functions.ExplicitlyCastableSignature;
|
||||
import org.apache.doris.nereids.trees.expressions.literal.Literal;
|
||||
import org.apache.doris.nereids.trees.expressions.literal.NullLiteral;
|
||||
import org.apache.doris.nereids.trees.expressions.shape.TernaryExpression;
|
||||
import org.apache.doris.nereids.trees.expressions.visitor.ExpressionVisitor;
|
||||
@ -50,19 +49,11 @@ public class Lead extends WindowFunction implements TernaryExpression, Explicitl
|
||||
|
||||
private static final List<FunctionSignature> SIGNATURES;
|
||||
|
||||
public Lead(Expression child) {
|
||||
this(child, Literal.of(1), Literal.of(null));
|
||||
}
|
||||
|
||||
public Lead(Expression child, Expression offset) {
|
||||
this(child, offset, Literal.of(null));
|
||||
}
|
||||
|
||||
public Lead(Expression child, Expression offset, Expression defaultValue) {
|
||||
super("lead", child, offset, defaultValue);
|
||||
}
|
||||
|
||||
public Lead(List<Expression> children) {
|
||||
private Lead(List<Expression> children) {
|
||||
super("lead", children);
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,11 @@
|
||||
-- This file is automatically generated. You should know what you did if you want to edit this
|
||||
-- !agg_output_as_right_tale_left_outer_order --
|
||||
0
|
||||
|
||||
-- !agg_output_as_right_tale_left_outer_order_2 --
|
||||
0
|
||||
|
||||
-- !agg_output_as_right_tale_left_outer_order_3 --
|
||||
1 1
|
||||
2 2
|
||||
3 3
|
||||
|
||||
@ -1,5 +1,11 @@
|
||||
-- This file is automatically generated. You should know what you did if you want to edit this
|
||||
-- !bucket_shuffle_join --
|
||||
0
|
||||
|
||||
-- !bucket_shuffle_join_2 --
|
||||
0
|
||||
|
||||
-- !bucket_shuffle_join_3 --
|
||||
1 2021-12-01T00:00
|
||||
2 2021-12-01T00:00
|
||||
|
||||
|
||||
@ -1,8 +1,14 @@
|
||||
-- This file is automatically generated. You should know what you did if you want to edit this
|
||||
-- !full_join --
|
||||
n fj n \N \N
|
||||
n fj n \N \N
|
||||
0
|
||||
|
||||
-- !full_join_2 --
|
||||
0
|
||||
|
||||
-- !full_join_3 --
|
||||
n fj n \N \N
|
||||
n fj n \N \N
|
||||
|
||||
-- !full_join_4 --
|
||||
n fj n \N \N
|
||||
|
||||
|
||||
@ -1,4 +1,10 @@
|
||||
-- This file is automatically generated. You should know what you did if you want to edit this
|
||||
-- !issue_7288 --
|
||||
0
|
||||
|
||||
-- !issue_7288_2 --
|
||||
0
|
||||
|
||||
-- !issue_7288_3 --
|
||||
1 \N
|
||||
|
||||
|
||||
@ -1,12 +1,18 @@
|
||||
-- This file is automatically generated. You should know what you did if you want to edit this
|
||||
-- !test_outer_join --
|
||||
0
|
||||
|
||||
-- !test_outer_join_2 --
|
||||
0
|
||||
|
||||
-- !test_outer_join_3 --
|
||||
\N 1
|
||||
\N 2
|
||||
\N 3
|
||||
\N 4
|
||||
\N 5
|
||||
|
||||
-- !test_outer_join_2 --
|
||||
-- !test_outer_join_4 --
|
||||
1 \N
|
||||
2 \N
|
||||
3 \N
|
||||
|
||||
@ -1,5 +1,11 @@
|
||||
-- This file is automatically generated. You should know what you did if you want to edit this
|
||||
-- !test_outer_join_with_delete_column --
|
||||
0
|
||||
|
||||
-- !test_outer_join_with_delete_column_2 --
|
||||
0
|
||||
|
||||
-- !test_outer_join_with_delete_column_3 --
|
||||
\N \N H220427011909770192580 2022-04-27T16:00:04
|
||||
\N \N H220427011909800104411 2022-04-27T16:00:14
|
||||
\N \N H220427011909820192943 2022-04-27T16:00:23
|
||||
|
||||
@ -1,4 +1,10 @@
|
||||
-- This file is automatically generated. You should know what you did if you want to edit this
|
||||
-- !dateTimeOperatorsAccessible --
|
||||
2012-08-10T00:00 2012-08-09T06:00 2012-11-30T01:00 2012-08-06T00:00 2012-08-06T20:00 2012-09-30T01:00
|
||||
0
|
||||
|
||||
-- !dateTimeOperatorsAccessible_2 --
|
||||
0
|
||||
|
||||
-- !dateTimeOperatorsAccessible_3 --
|
||||
2012-08-10 2012-08-09T06:00 2012-11-30T01:00 2012-08-06 2012-08-06T20:00 2012-09-30T01:00
|
||||
|
||||
|
||||
@ -1,4 +1,10 @@
|
||||
-- This file is automatically generated. You should know what you did if you want to edit this
|
||||
-- !extractAccessible --
|
||||
0
|
||||
|
||||
-- !extractAccessible_2 --
|
||||
0
|
||||
|
||||
-- !extractAccessible_3 --
|
||||
22
|
||||
|
||||
|
||||
@ -1 +1,4 @@
|
||||
select t1.k1,t2.k1 from test_join t1 left join (select k1 from test_join group by k1) t2 on t1.k1=t2.k1
|
||||
set enable_nereids_planner=true;
|
||||
set enable_fallback_to_original_planner=false;
|
||||
|
||||
select t1.k1,t2.k1 from test_join t1 left join (select k1 from test_join group by k1) t2 on t1.k1=t2.k1 order by t1.k1, t2.k1
|
||||
@ -1 +1,4 @@
|
||||
select * from test_bucket_shuffle_join where rectime="2021-12-01 00:00:00" and id in (select k1 from test_join where k1 in (1,2))
|
||||
set enable_nereids_planner=true;
|
||||
set enable_fallback_to_original_planner=false;
|
||||
|
||||
select * from test_bucket_shuffle_join where rectime="2021-12-01 00:00:00" and id in (select k1 from test_join where k1 in (1,2)) order by id;
|
||||
|
||||
@ -1,2 +1,5 @@
|
||||
set enable_nereids_planner=true;
|
||||
set enable_fallback_to_original_planner=false;
|
||||
|
||||
SELECT 'n fj n', t1.x, t2.x FROM full_join_table AS t1 FULL JOIN full_join_table AS t2 ON t1.x = t2.x ORDER BY t1.x;
|
||||
SELECT 'n fj n', t1.x, t2.x FROM full_join_table AS t1 FULL JOIN full_join_table AS t2 ON t1.x <=> t2.x ORDER BY t1.x;
|
||||
|
||||
@ -1,3 +1,6 @@
|
||||
--- Nereids does't support array function
|
||||
--- select xs.plat_id,xs.company_id, xs_email, xs_group_id, kf_email, kf_group_id from (select plat_id, company_id, concat_ws(",", array_sort(collect_set(`user_email`))) xs_email, concat_ws(",", array_sort(collect_set(`group_id`))) xs_group_id from table_3 where plat_id = 1 and is_delete = 0 group by plat_id, company_id) xs left join (select plat_id, company_id, concat_ws(",", array_sort(collect_set(`user_email`))) kf_email, concat_ws(",", array_sort(collect_set(`group_id`))) kf_group_id from table_3 where plat_id = 1 and is_delete = 0 group by plat_id, company_id) kf on xs.plat_id = kf.plat_id and xs.company_id = kf.company_id;
|
||||
|
||||
--- set enable_nereids_planner=true;
|
||||
--- set enable_fallback_to_original_planner=false;
|
||||
|
||||
--- select xs.plat_id,xs.company_id, xs_email, xs_group_id, kf_email, kf_group_id from (select plat_id, company_id, concat_ws(",", array_sort(collect_set(`user_email`))) xs_email, concat_ws(",", array_sort(collect_set(`group_id`))) xs_group_id from table_3 where plat_id = 1 and is_delete = 0 group by plat_id, company_id) xs left join (select plat_id, company_id, concat_ws(",", array_sort(collect_set(`user_email`))) kf_email, concat_ws(",", array_sort(collect_set(`group_id`))) kf_group_id from table_3 where plat_id = 1 and is_delete = 0 group by plat_id, company_id) kf on xs.plat_id = kf.plat_id and xs.company_id = kf.company_id;
|
||||
|
||||
@ -1 +1,4 @@
|
||||
select l.k1, group_concat(r.no) from left_table l left join right_table r on l.k1=r.k1 group by l.k1;
|
||||
set enable_nereids_planner=true;
|
||||
set enable_fallback_to_original_planner=false;
|
||||
|
||||
select l.k1, group_concat(r.no) from left_table l left join right_table r on l.k1=r.k1 group by l.k1 order by k1;
|
||||
@ -1,2 +1,5 @@
|
||||
set enable_nereids_planner=true;
|
||||
set enable_fallback_to_original_planner=false;
|
||||
|
||||
select b.k1, c.k1 from test_join b right join test_join c on b.k1 = c.k1 and 2=4 order by 1,2;
|
||||
select b.k1, c.k1 from test_join b left join test_join c on b.k1 = c.k1 and 2=4 order by 1,2;
|
||||
|
||||
@ -1,3 +1,6 @@
|
||||
set enable_nereids_planner=true;
|
||||
set enable_fallback_to_original_planner=false;
|
||||
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
|
||||
@ -1,5 +1,8 @@
|
||||
/*
|
||||
-- database: presto; groups: qe, horology_functions
|
||||
SET enable_nereids_planner=true;
|
||||
SET enable_fallback_to_original_planner=false;
|
||||
|
||||
SELECT timezone_hour(TIMESTAMP '2001-08-22 03:04:05.321' at time zone 'Asia/Oral'),
|
||||
timezone_minute(TIMESTAMP '2001-08-22 03:04:05.321' at time zone 'Asia/Oral')
|
||||
*/
|
||||
|
||||
@ -1,4 +1,7 @@
|
||||
-- database: presto; groups: qe, horology_functions
|
||||
SET enable_nereids_planner=true;
|
||||
SET enable_fallback_to_original_planner=false;
|
||||
|
||||
SELECT date '2012-08-08' + interval '2' day,
|
||||
timestamp '2012-08-08 01:00' + interval '29' hour,
|
||||
timestamp '2012-10-31 01:00' + interval '1' month,
|
||||
|
||||
@ -1,2 +1,5 @@
|
||||
-- database: presto; groups: qe, horology_functions
|
||||
SET enable_nereids_planner=true;
|
||||
SET enable_fallback_to_original_planner=false;
|
||||
|
||||
SELECT extract(day from TIMESTAMP '2001-08-22 03:04:05.321')
|
||||
@ -214,7 +214,7 @@ suite("join") {
|
||||
|
||||
sql """drop table if exists test_memo_1"""
|
||||
sql """drop table if exists test_memo_2"""
|
||||
sql """drop table if exists test_memo_2"""
|
||||
sql """drop table if exists test_memo_3"""
|
||||
|
||||
sql """ CREATE TABLE `test_memo_1` (
|
||||
`c_bigint` bigint(20) NULL,
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
-- database: presto; groups: qe, horology_functions
|
||||
SELECT date '2012-08-08' + interval '2' day,
|
||||
SELECT /*+ SET_VAR(enable_nereids_planner=false) */ date '2012-08-08' + interval '2' day,
|
||||
timestamp '2012-08-08 01:00' + interval '29' hour,
|
||||
timestamp '2012-10-31 01:00' + interval '1' month,
|
||||
date '2012-08-08' - interval '2' day,
|
||||
|
||||
@ -363,7 +363,9 @@ suite("test_window_function") {
|
||||
// test error
|
||||
test {
|
||||
sql("select /*+SET_VAR(parallel_fragment_exec_instance_num=1) */ ${k1}, lag(${k2}) over (partition by ${k1} order by ${k3}) from baseall")
|
||||
exception "errCode = 2, detailMessage = Lag/offset must have three parameters"
|
||||
check { result, exception, startTime, endTime ->
|
||||
assertTrue(exception != null)
|
||||
}
|
||||
}
|
||||
test {
|
||||
sql"select /*+SET_VAR(parallel_fragment_exec_instance_num=1) */ ${k1}, lag(${k2}, -1, 1) over (partition by ${k1} order by ${k3}) from baseall"
|
||||
|
||||
@ -16,6 +16,10 @@
|
||||
// under the License.
|
||||
|
||||
suite("query_stats_test") {
|
||||
|
||||
// nereids not support query stats now, fallback to legacy planner.
|
||||
sql """set enable_nereids_planner=false"""
|
||||
|
||||
def tbName = "stats_table"
|
||||
sql """ DROP TABLE IF EXISTS ${tbName} """
|
||||
sql """
|
||||
|
||||
@ -42,6 +42,10 @@ def getRandomNumber(int num){
|
||||
}
|
||||
|
||||
suite('test_profile') {
|
||||
|
||||
// nereids not return same profile with legacy planner, fallback to legacy planner.
|
||||
sql """set enable_nereids_planner=false"""
|
||||
|
||||
def table = 'test_profile_table'
|
||||
def id_data = [1,2,3,4,5,6,7]
|
||||
def value_data = [1,2,3,4,5,6,7]
|
||||
|
||||
Reference in New Issue
Block a user