You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by mo...@apache.org on 2023/01/20 06:16:00 UTC
[doris] branch master updated: [test](Nereids)add test aboule dateType and dateTimeType (#16098)
This is an automated email from the ASF dual-hosted git repository.
morrysnow 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 3652cb3fe9 [test](Nereids)add test aboule dateType and dateTimeType (#16098)
3652cb3fe9 is described below
commit 3652cb3fe9bc5bc5f19ab9f5b30236b434009aed
Author: mch_ucchi <41...@users.noreply.github.com>
AuthorDate: Fri Jan 20 14:15:54 2023 +0800
[test](Nereids)add test aboule dateType and dateTimeType (#16098)
---
.../doris/nereids/util/TypeCoercionUtils.java | 1 +
.../suites/nereids_syntax_p0/runtime_filter.groovy | 49 ++++++++++++++++++++++
2 files changed, 50 insertions(+)
diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/util/TypeCoercionUtils.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/util/TypeCoercionUtils.java
index fdaa263af3..8ea3936fc9 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/nereids/util/TypeCoercionUtils.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/util/TypeCoercionUtils.java
@@ -238,6 +238,7 @@ public class TypeCoercionUtils {
|| left instanceof DecimalV2Type && right instanceof DateLikeType) {
tightestCommonType = DoubleType.INSTANCE;
} else if (left instanceof DateLikeType && right instanceof DateLikeType) {
+ // if dateType exist, change all to dateType, otherwise change all to dateTimeType
if (left instanceof DateTimeV2Type && right instanceof DateTimeV2Type) {
if (((DateTimeV2Type) left).getScale() > ((DateTimeV2Type) right).getScale()) {
tightestCommonType = left;
diff --git a/regression-test/suites/nereids_syntax_p0/runtime_filter.groovy b/regression-test/suites/nereids_syntax_p0/runtime_filter.groovy
new file mode 100644
index 0000000000..c109ae5c8c
--- /dev/null
+++ b/regression-test/suites/nereids_syntax_p0/runtime_filter.groovy
@@ -0,0 +1,49 @@
+// 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("runtime_filter") {
+ sql "drop table if exists date_v2_table"
+ sql "drop table if exists datetime_table"
+
+ sql """CREATE TABLE `date_v2_table` (
+ `user_id` largeint(40) NOT NULL COMMENT '用户id',
+ `date` dateV2 NOT NULL COMMENT '数据灌入日期时间'
+ ) distributed by hash(user_id) buckets 1
+ properties("replication_num"="1");
+ """
+
+ sql """CREATE TABLE `datetime_table` (
+ `user_id` largeint(40) NOT NULL COMMENT '用户id',
+ `date` datetime NOT NULL COMMENT '数据灌入日期时间'
+ ) distributed by hash(user_id) buckets 1
+ properties("replication_num"="1");
+ """
+
+ sql "insert into `date_v2_table` values (1, '2011-01-01'), (2, '2011-02-02');"
+ sql "insert into `datetime_table` values (1, '2011-01-01 13:00:00'), (2, '2011-02-02 13:00:00');"
+
+ sql "set enable_nereids_planner=true"
+ sql "set enable_fallback_to_original_planner=false"
+
+ for (int i = 0; i < 32; ++i) {
+ sql "set runtime_filter_type=${i}"
+ test {
+ sql "SELECT count(1) FROM datetime_table a, date_v2_table b WHERE a.date = b.date;"
+ result([[2L]])
+ }
+ }
+}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org