You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by ya...@apache.org on 2022/10/27 03:48:49 UTC
[doris] branch master updated: [bugfix](join) inner join return wrong result (#13608)
This is an automated email from the ASF dual-hosted git repository.
yangzhg 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 738da0b139 [bugfix](join) inner join return wrong result (#13608)
738da0b139 is described below
commit 738da0b1392bee4247b1edb985e2208ee03acbea
Author: camby <10...@qq.com>
AuthorDate: Thu Oct 27 11:48:41 2022 +0800
[bugfix](join) inner join return wrong result (#13608)
* bug fix for vhash join
* add regression test
Co-authored-by: cambyzju <zh...@baidu.com>
---
be/src/vec/exec/join/vhash_join_node.cpp | 6 +--
.../array_functions/test_issue_13606.out | 11 +++++
.../array_functions/test_issue_13606.groovy | 56 ++++++++++++++++++++++
3 files changed, 70 insertions(+), 3 deletions(-)
diff --git a/be/src/vec/exec/join/vhash_join_node.cpp b/be/src/vec/exec/join/vhash_join_node.cpp
index 1b8023da70..91b5784da3 100644
--- a/be/src/vec/exec/join/vhash_join_node.cpp
+++ b/be/src/vec/exec/join/vhash_join_node.cpp
@@ -231,7 +231,7 @@ void ProcessHashTableProbe<JoinOpType, ignore_null>::build_side_output_column(
mcol[i + column_offset]->insert_indices_from(column, _build_block_rows.data(),
_build_block_rows.data() + size);
} else {
- mcol[i + column_offset]->resize(size);
+ mcol[i + column_offset]->insert_many_defaults(size);
}
}
} else {
@@ -267,7 +267,7 @@ void ProcessHashTableProbe<JoinOpType, ignore_null>::build_side_output_column(
}
}
} else {
- mcol[i + column_offset]->resize(size);
+ mcol[i + column_offset]->insert_many_defaults(size);
}
}
}
@@ -300,7 +300,7 @@ void ProcessHashTableProbe<JoinOpType, ignore_null>::probe_side_output_column(
column->replicate(&_items_counts[0], size, *mcol[i], last_probe_index, probe_size);
}
} else {
- mcol[i]->resize(size);
+ mcol[i]->insert_many_defaults(size);
}
}
diff --git a/regression-test/data/query_p0/sql_functions/array_functions/test_issue_13606.out b/regression-test/data/query_p0/sql_functions/array_functions/test_issue_13606.out
new file mode 100644
index 0000000000..c8a1dd2c28
--- /dev/null
+++ b/regression-test/data/query_p0/sql_functions/array_functions/test_issue_13606.out
@@ -0,0 +1,11 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !select --
+1 3
+3 3
+3 3
+
+-- !select --
+3
+3
+3
+
diff --git a/regression-test/suites/query_p0/sql_functions/array_functions/test_issue_13606.groovy b/regression-test/suites/query_p0/sql_functions/array_functions/test_issue_13606.groovy
new file mode 100644
index 0000000000..e179b8b358
--- /dev/null
+++ b/regression-test/suites/query_p0/sql_functions/array_functions/test_issue_13606.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("test_issue_13606") {
+ def tableName1 = "test_issue_13606_1"
+ def tableName2 = "test_issue_13606_2"
+ // array functions only supported in vectorized engine
+ sql """ set enable_vectorized_engine = true """
+
+ sql """DROP TABLE IF EXISTS ${tableName1}"""
+ sql """DROP TABLE IF EXISTS ${tableName2}"""
+ sql """
+ CREATE TABLE IF NOT EXISTS ${tableName1} (
+ `k1` int(11) NULL COMMENT "",
+ `a1` ARRAY<int(11)> NOT NULL COMMENT ""
+ ) ENGINE=OLAP
+ DUPLICATE KEY(`k1`)
+ DISTRIBUTED BY HASH(`k1`) BUCKETS 10
+ PROPERTIES (
+ "replication_allocation" = "tag.location.default: 1",
+ "storage_format" = "V2"
+ )
+ """
+ sql """
+ CREATE TABLE IF NOT EXISTS ${tableName2} (
+ `k1` int(11) NULL COMMENT "",
+ `a1` ARRAY<int(11)> NOT NULL COMMENT ""
+ ) ENGINE=OLAP
+ DUPLICATE KEY(`k1`)
+ DISTRIBUTED BY HASH(`k1`) BUCKETS 10
+ PROPERTIES (
+ "replication_allocation" = "tag.location.default: 1",
+ "storage_format" = "V2"
+ )
+ """
+
+ sql """ INSERT INTO ${tableName1} VALUES(1, [1,2,3]),(3,[3,2,1]),(3,[3,2,1,NULL]),(2,[3,4,5]) """
+ sql """ INSERT INTO ${tableName2} VALUES(1,[2]),(2,[3]) """
+
+ qt_select "SELECT ${tableName1}.k1 as t1k1,array_min(${tableName2}.a1) as min FROM ${tableName1} JOIN ${tableName2} WHERE array_max(${tableName1}.a1) = array_max(${tableName2}.a1) ORDER BY t1k1,min"
+ qt_select "SELECT array_min(${tableName2}.a1) as min FROM ${tableName1} JOIN ${tableName2} WHERE array_max(${tableName1}.a1) = array_max(${tableName2}.a1) ORDER BY min"
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org