This is an automated email from the ASF dual-hosted git repository. starocean999 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push: new 5b043a980e [fix](planner)only forbid literal value in AnalyticExpr's order by list (#21819) 5b043a980e is described below commit 5b043a980ee97790d1ac14e5b28067ba91bfbe63 Author: starocean999 <40539150+starocean...@users.noreply.github.com> AuthorDate: Wed Jul 19 09:40:55 2023 +0800 [fix](planner)only forbid literal value in AnalyticExpr's order by list (#21819) * [fix](planner)only forbid literal value in AnalyticExpr's order by list --- .../org/apache/doris/analysis/AnalyticExpr.java | 4 +-- .../conditional_functions/test_nullif.out | 4 +++ .../conditional_functions/test_nullif.groovy | 35 ++++++++++++++++++++++ 3 files changed, 41 insertions(+), 2 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/AnalyticExpr.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/AnalyticExpr.java index 04ab5d0fa3..2a9e9a9c88 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/analysis/AnalyticExpr.java +++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/AnalyticExpr.java @@ -465,7 +465,7 @@ public class AnalyticExpr extends Expr { type = getFnCall().getType(); for (Expr e : partitionExprs) { - if (e.isConstant()) { + if (e.isLiteral()) { throw new AnalysisException( "Expressions in the PARTITION BY clause must not be constant: " + e.toSql() + " (in " + toSql() + ")"); @@ -473,7 +473,7 @@ public class AnalyticExpr extends Expr { } for (OrderByElement e : orderByElements) { - if (e.getExpr().isConstant()) { + if (e.getExpr().isLiteral()) { throw new AnalysisException( "Expressions in the ORDER BY clause must not be constant: " + e.getExpr().toSql() + " (in " + toSql() + ")"); diff --git a/regression-test/data/query_p0/sql_functions/conditional_functions/test_nullif.out b/regression-test/data/query_p0/sql_functions/conditional_functions/test_nullif.out index f0746996f0..12fcd68da3 100644 --- a/regression-test/data/query_p0/sql_functions/conditional_functions/test_nullif.out +++ b/regression-test/data/query_p0/sql_functions/conditional_functions/test_nullif.out @@ -570,3 +570,7 @@ null 12 1 true -- !if_nullif28 -- 2020-02-09 +-- !if_nullif29 -- +1 1 +2 2 + diff --git a/regression-test/suites/query_p0/sql_functions/conditional_functions/test_nullif.groovy b/regression-test/suites/query_p0/sql_functions/conditional_functions/test_nullif.groovy index fb305884cc..6d1a5948a4 100644 --- a/regression-test/suites/query_p0/sql_functions/conditional_functions/test_nullif.groovy +++ b/regression-test/suites/query_p0/sql_functions/conditional_functions/test_nullif.groovy @@ -151,4 +151,39 @@ suite("test_nullif") { qt_if_nullif27 """select ifnull(2+3, 2), ifnull((3*1 > 1 || 1>0), 2), ifnull((3*1 > 1 or 1>0), 2), ifnull(upper("null"), concat("NUL", "LL"))""" qt_if_nullif28 """select ifnull(date(substring("2020-02-09", 1, 1024)), null)""" + + def tableName2 = "testsort" + + sql """ DROP TABLE IF EXISTS ${tableName2}; """ + sql """ + CREATE TABLE IF NOT EXISTS ${tableName2} ( + c_int int NULL COMMENT "", + c_pv bitmap BITMAP_UNION NULL COMMENT "" + ) + AGGREGATE KEY(c_int) + DISTRIBUTED BY HASH(c_int) BUCKETS 1 + PROPERTIES ( + "replication_num" = "1" + ); + """ + sql """ INSERT INTO ${tableName2} VALUES(1, to_bitmap(1)), (2, to_bitmap(2));""" + + qt_if_nullif29 """ + select + sortNum, + BITMAP_UNION_COUNT (c.pv) over (ORDER BY sortNum ) totalNum + from( + select + ifnull(a.sortNum, b.sortNum) sortNum, + BITMAP_UNION (ifnull(a.c_pv, b.c_pv)) pv + from + (select 1 sortNum, c_pv from ${tableName2} t where t.c_int = 1) a + full join + (select 2 sortNum, c_pv from ${tableName2} t where t.c_int = 2) b + on a.sortNum = b.sortNum + GROUP BY + sortNum + ORDER BY + sortNum + ) c;""" } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org