You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by yi...@apache.org on 2023/04/26 03:51:29 UTC
[doris] branch branch-1.2-lts updated: [fix](shuffle) fix bug of buccket shuffle of datetime column (#19065)
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 af81719b4d [fix](shuffle) fix bug of buccket shuffle of datetime column (#19065)
af81719b4d is described below
commit af81719b4df7c764401e87ca743a7449238ae680
Author: TengJianPing <18...@users.noreply.github.com>
AuthorDate: Wed Apr 26 11:51:21 2023 +0800
[fix](shuffle) fix bug of buccket shuffle of datetime column (#19065)
---
be/src/vec/columns/column_vector.cpp | 2 +-
.../test_join_bucket_shffule_hash_partitioned.out | 11 +++
...est_join_bucket_shffule_hash_partitioned.groovy | 92 ++++++++++++++++++++++
3 files changed, 104 insertions(+), 1 deletion(-)
diff --git a/be/src/vec/columns/column_vector.cpp b/be/src/vec/columns/column_vector.cpp
index 0ca8bbdecb..e656b97f2e 100644
--- a/be/src/vec/columns/column_vector.cpp
+++ b/be/src/vec/columns/column_vector.cpp
@@ -175,7 +175,7 @@ void ColumnVector<T>::update_crcs_with_value(std::vector<uint64_t>& hashes, Prim
if (type == TYPE_DATE || type == TYPE_DATETIME) {
char buf[64];
auto date_convert_do_crc = [&](size_t i) {
- const DateTimeValue& date_val = (const DateTimeValue&)data[i];
+ const VecDateTimeValue& date_val = (const VecDateTimeValue&)data[i];
auto len = date_val.to_buffer(buf);
hashes[i] = HashUtil::zlib_crc_hash(buf, len, hashes[i]);
};
diff --git a/regression-test/data/query_p0/join/test_join_bucket_shffule_hash_partitioned.out b/regression-test/data/query_p0/join/test_join_bucket_shffule_hash_partitioned.out
new file mode 100644
index 0000000000..3f4b102984
--- /dev/null
+++ b/regression-test/data/query_p0/join/test_join_bucket_shffule_hash_partitioned.out
@@ -0,0 +1,11 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !sql_join1 --
+1 1 2023-04-25T00:00 1 1 2023-04-25T00:00
+2 2 2023-04-26T00:00 2 2 2023-04-26T00:00
+3 3 2023-04-27T00:00 \N \N \N
+
+-- !sql_join1 --
+1 1 2023-04-25T00:00 1 1 2023-04-25T00:00
+2 2 2023-04-26T00:00 2 2 2023-04-26T00:00
+3 3 2023-04-27T00:00 \N \N \N
+
diff --git a/regression-test/suites/query_p0/join/test_join_bucket_shffule_hash_partitioned.groovy b/regression-test/suites/query_p0/join/test_join_bucket_shffule_hash_partitioned.groovy
new file mode 100644
index 0000000000..0af93839b1
--- /dev/null
+++ b/regression-test/suites/query_p0/join/test_join_bucket_shffule_hash_partitioned.groovy
@@ -0,0 +1,92 @@
+// 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("test_join_bucket_shffule_hash_partitioned", "query,p0") {
+ sql """ drop table if exists t1; """
+ sql """ create table t1 (
+ k1 int not null,
+ kdate datetime not null,
+ k2 int not null,
+ v1 int not null
+ ) DISTRIBUTED BY HASH (k1, kdate) buckets 4
+ PROPERTIES (
+ "replication_num" = "1"
+ ); """
+
+ sql """ insert into t1 values (1,"2023-04-25 00:00:00", 1, 1),
+ (2,"2023-04-26 00:00:00", 2, 2),
+ (3,"2023-04-27 00:00:00", 3, 3);
+ """
+
+ sql """ drop table if exists t2; """
+ sql """ create table t2 (
+ k1 int not null,
+ k2 int not null,
+ kdate datetime not null,
+ v1 int not null
+ ) DISTRIBUTED BY HASH (k1, k2, kdate) buckets 4
+ PROPERTIES (
+ "replication_num" = "1"
+ );
+ """
+
+ sql """ insert into t2 values (1,1,"2023-04-25 00:00:00", 1),
+ (2,2,"2023-04-26 00:00:00", 2);
+ """
+
+ qt_sql_join1 """ select /*+SET_VAR(parallel_fragment_exec_instance_num=1)*/
+ t1.k1,
+ t1.k2,
+ t1.kdate,
+ t2.k1,
+ t2.k2,
+ t2.kdate
+ from
+ t1
+ left join t2 on t1.k1 = t2.k1
+ and t1.k2 = t2.k2
+ and t1.kdate = t2.kdate
+ order by
+ t1.k1,
+ t1.k2,
+ t1.kdate,
+ t2.k1,
+ t2.k2,
+ t2.kdate;
+ """
+
+ qt_sql_join1 """ select /*+SET_VAR(parallel_fragment_exec_instance_num=4)*/
+ t1.k1,
+ t1.k2,
+ t1.kdate,
+ t2.k1,
+ t2.k2,
+ t2.kdate
+ from
+ t1
+ left join t2 on t1.k1 = t2.k1
+ and t1.k2 = t2.k2
+ and t1.kdate = t2.kdate
+ order by
+ t1.k1,
+ t1.k2,
+ t1.kdate,
+ t2.k1,
+ t2.k2,
+ t2.kdate;
+ """
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org