This is an automated email from the ASF dual-hosted git repository.
morrysnow pushed a commit to branch branch-3.1
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-3.1 by this push:
new 586330e9d9a branch-3.1: [fix](regress) fix
test_simplify_comparison_predicate #51765 (#54350)
586330e9d9a is described below
commit 586330e9d9a1b0c736931d1669af8d9b18829e5c
Author: yujun <[email protected]>
AuthorDate: Wed Aug 6 11:06:36 2025 +0800
branch-3.1: [fix](regress) fix test_simplify_comparison_predicate #51765
(#54350)
cherry pick from #51765
---
.../test_simplify_comparison_predicate.groovy | 50 +++++++++-------------
1 file changed, 21 insertions(+), 29 deletions(-)
diff --git
a/regression-test/suites/nereids_rules_p0/expression/test_simplify_comparison_predicate.groovy
b/regression-test/suites/nereids_rules_p0/expression/test_simplify_comparison_predicate.groovy
index c7198ebf32d..1896bce644f 100644
---
a/regression-test/suites/nereids_rules_p0/expression/test_simplify_comparison_predicate.groovy
+++
b/regression-test/suites/nereids_rules_p0/expression/test_simplify_comparison_predicate.groovy
@@ -19,30 +19,20 @@
// TODO: date datetime comparison still has bug, need fix.
suite('test_simplify_comparison_predicate', 'nonConcurrent') {
def tbl = 'test_simplify_comparison_predicate_tbl'
- def falseOrNull = { expr -> "${expr} IS NULL AND NULL" }
+ def falseOrNull = { expr -> "AND[${expr} IS NULL,NULL]" }
def checkExplain = { expression, resExpression ->
- def checker = { explainString, exception, startTime, endTime ->
- assertNull(exception)
- def foundOutputExprs = false
- def succ = false
- for (def line : explainString.split('\n')) {
- if (foundOutputExprs) {
- assertTrue(line.contains(resExpression), "'${line}' no
contains '${resExpression}'")
- succ = true
- break
- }
- if (line.contains('OUTPUT EXPRS:')) {
- foundOutputExprs = true
- }
+ def shapePlan = sql("EXPLAIN SHAPE PLAN SELECT ${expression} FROM
${tbl}")
+ // logger.info("shape plan: ${shapePlan}")
+ def foundOutputExprs = false
+ for (def node : shapePlan) {
+ def line = node.get(0)
+ if (line.contains('PhysicalProject')) {
+ def expectSubStr = "PhysicalProject[${resExpression}"
+ assertTrue(line.contains(expectSubStr), "'${line}' no contains
'${expectSubStr}'")
+ foundOutputExprs = true
}
- assertTrue(foundOutputExprs)
- assertTrue(succ)
- }
-
- explain {
- sql "SELECT ${expression} FROM ${tbl}"
- check checker
}
+ assertTrue(foundOutputExprs)
}
def testSimplify = { checkNullColumn, checkNotNullColumn, expression,
resExpression ->
def types = ['']
@@ -76,6 +66,8 @@ suite('test_simplify_comparison_predicate', 'nonConcurrent') {
setFeConfigTemporary([disable_datev1:false, disable_decimalv2:false]) {
sql """
+ SET detail_shape_nodes='PhysicalProject';
+
DROP TABLE IF EXISTS ${tbl} FORCE;
CREATE TABLE ${tbl} (
@@ -138,10 +130,10 @@ suite('test_simplify_comparison_predicate',
'nonConcurrent') {
testSimplify false, false, 'c_decimal_5_2_null = CAST(1.12 as
DECIMAL(10, 5))', '(c_decimal_5_2_null = 1.12)'
testSimplify false, false, 'c_decimal_5_2_null = CAST(1.123 as
DECIMAL(10, 5))', falseOrNull('c_decimal_5_2_null')
testSimplify false, false, 'c_decimal_5_2 = CAST(1.123 as DECIMAL(10,
5))', 'FALSE'
- testSimplify false, false, 'c_decimal_5_2_null > CAST(1.123 as
DECIMAL(10, 5))', 'c_decimal_5_2_null > 1.12'
- testSimplify false, false, 'c_decimal_5_2_null >= CAST(1.123 as
DECIMAL(10, 5))', 'c_decimal_5_2_null >= 1.13'
- testSimplify false, false, 'c_decimal_5_2_null <= CAST(1.123 as
DECIMAL(10, 5))', 'c_decimal_5_2_null <= 1.12'
- testSimplify false, false, 'c_decimal_5_2_null < CAST(1.123 as
DECIMAL(10, 5))', 'c_decimal_5_2_null < 1.13'
+ testSimplify false, false, 'c_decimal_5_2_null > CAST(1.123 as
DECIMAL(10, 5))', '(c_decimal_5_2_null > 1.12)'
+ testSimplify false, false, 'c_decimal_5_2_null >= CAST(1.123 as
DECIMAL(10, 5))', '(c_decimal_5_2_null >= 1.13)'
+ testSimplify false, false, 'c_decimal_5_2_null <= CAST(1.123 as
DECIMAL(10, 5))', '(c_decimal_5_2_null <= 1.12)'
+ testSimplify false, false, 'c_decimal_5_2_null < CAST(1.123 as
DECIMAL(10, 5))', '(c_decimal_5_2_null < 1.13)'
testSimplify false, false, "CAST(c_datetime_0 AS DATETIME(5)) =
'2000-01-01'", "(c_datetime_0 = '2000-01-01 00:00:00')"
testSimplify false, false, "CAST(c_datetime_0 AS DATETIME(5)) =
'2000-01-01 00:00:00.1'", 'FALSE'
testSimplify false, false, "CAST(c_datetime_0_null AS DATETIME(5)) =
'2000-01-01 00:00:00.1'", falseOrNull('c_datetime_0_null')
@@ -161,10 +153,10 @@ suite('test_simplify_comparison_predicate',
'nonConcurrent') {
testSimplify false, false, "c_date = '2000-01-01 00:00:01'", 'FALSE'
testSimplify false, false, "CAST(c_date_null AS DATETIME(5)) =
'2000-01-01 00:00:01'", falseOrNull('c_date_null')
testSimplify false, false, "CAST(c_date_null AS DATETIME(5)) <=>
'2000-01-01 00:00:01'", 'FALSE'
- testSimplify false, false, "CAST(c_date AS DATETIME(5)) > '2000-01-01
00:00:01'", "c_date > '2000-01-01'"
- testSimplify false, false, "CAST(c_date AS DATETIME(5)) >= '2000-01-01
00:00:01'", "c_date >= '2000-01-02'"
- testSimplify false, false, "CAST(c_date AS DATETIME(5)) <= '2000-01-01
00:00:01'", "c_date <= '2000-01-01'"
- testSimplify false, false, "CAST(c_date AS DATETIME(5)) < '2000-01-01
00:00:01'", "c_date < '2000-01-02'"
+ testSimplify false, false, "CAST(c_date AS DATETIME(5)) > '2000-01-01
00:00:01'", "(c_date > '2000-01-01')"
+ testSimplify false, false, "CAST(c_date AS DATETIME(5)) >= '2000-01-01
00:00:01'", "(c_date >= '2000-01-02')"
+ testSimplify false, false, "CAST(c_date AS DATETIME(5)) <= '2000-01-01
00:00:01'", "(c_date <= '2000-01-01')"
+ testSimplify false, false, "CAST(c_date AS DATETIME(5)) < '2000-01-01
00:00:01'", "(c_date < '2000-01-02')"
sql "DROP TABLE IF EXISTS ${tbl} FORCE"
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]