This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-1.2-lts
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-1.2-lts by this push:
new 40df08affb [fix](nereids) Fix analytic expr (#21903)
40df08affb is described below
commit 40df08affb0d8ba9f8b05db3140aecab5c39b90f
Author: AKIRA <[email protected]>
AuthorDate: Sun Aug 6 10:41:50 2023 +0800
[fix](nereids) Fix analytic expr (#21903)
---
.../org/apache/doris/analysis/AnalyticExpr.java | 8 ++--
.../suites/query_p0/aggregate/analytic_expr.groovy | 56 ++++++++++++++++++++++
2 files changed, 60 insertions(+), 4 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 8892cf9291..083bc56f1d 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
@@ -700,10 +700,10 @@ public class AnalyticExpr extends Expr {
+
getFnCall().getChildren().get(0).getType());
}
- if (getFnCall().getChildren().get(2) instanceof CastExpr) {
- throw new AnalysisException("Type = " + type + " can't not
convert to "
- +
getFnCall().getChildren().get(0).getType());
- }
+ // if (getFnCall().getChildren().get(2) instanceof CastExpr) {
+ // throw new AnalysisException("Type = " + type + " can't not
convert to "
+ // +
getFnCall().getChildren().get(0).getType());
+ // }
// check the value whether out of range
checkDefaultValue(analyzer);
diff --git a/regression-test/suites/query_p0/aggregate/analytic_expr.groovy
b/regression-test/suites/query_p0/aggregate/analytic_expr.groovy
new file mode 100644
index 0000000000..89c9e02f64
--- /dev/null
+++ b/regression-test/suites/query_p0/aggregate/analytic_expr.groovy
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+suite("analytic_expr_test") {
+ sql """
+ CREATE TABLE `test_load_03` (
+ `id` varchar(10) NULL,
+ `ctime` datetime NULL,
+ `url` text NULL
+ ) ENGINE=OLAP
+ DUPLICATE KEY(`id`)
+ COMMENT 'OLAP'
+ DISTRIBUTED BY HASH(`id`) BUCKETS 10
+ PROPERTIES (
+ "replication_allocation" = "tag.location.default: 1",
+ "storage_format" = "V2",
+ "light_schema_change" = "true",
+ "disable_auto_compaction" = "false"
+ );
+ """
+
+ sql """INSERT INTO `test_load_03` (`id`, `ctime`, `url`) VALUES ('Marry',
'2015-11-12 03:14:30', 'url5');"""
+ sql """INSERT INTO `test_load_03` (`id`, `ctime`, `url`) VALUES ('Marry',
'2015-11-12 02:13:00', 'url4');"""
+ sql """INSERT INTO `test_load_03` (`id`, `ctime`, `url`) VALUES ('Marry',
'2015-11-12 01:16:40', 'url3');"""
+ sql """INSERT INTO `test_load_03` (`id`, `ctime`, `url`) VALUES ('Marry',
'2015-11-12 01:15:10', 'url2');"""
+ sql """INSERT INTO `test_load_03` (`id`, `ctime`, `url`) VALUES ('Marry',
'2015-11-12 01:10:00', 'url1');"""
+ sql """INSERT INTO `test_load_03` (`id`, `ctime`, `url`) VALUES ('Peter',
'2015-10-12 03:14:30', 'url5');"""
+ sql """INSERT INTO `test_load_03` (`id`, `ctime`, `url`) VALUES ('Peter',
'2015-10-12 02:13:00', 'url4');"""
+ sql """INSERT INTO `test_load_03` (`id`, `ctime`, `url`) VALUES ('Peter',
'2015-10-12 01:16:40', 'url3');"""
+ sql """INSERT INTO `test_load_03` (`id`, `ctime`, `url`) VALUES ('Peter',
'2015-10-12 01:15:10', 'url2');"""
+ sql """INSERT INTO `test_load_03` (`id`, `ctime`, `url`) VALUES ('Peter',
'2015-10-12 01:10:00', 'url1');"""
+
+ sql """select
+ id,url,ctime,
+ first_value(ctime) over(partition by id order by ctime) as
first_ctime,
+ lag(ctime,1,0) over(partition by id order by ctime) as lag_ctime,
+ lead(ctime,1,0) over(partition by id order by ctime) as lead_ctime
+ from test_load_03;
+ """
+}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]