Skip to content

Commit

Permalink
[Bug-Fix][Vectorized] Full join return error result (#9690)
Browse files Browse the repository at this point in the history
Co-authored-by: lihaopeng <lihaopeng@baidu.com>
  • Loading branch information
HappenLee and lihaopeng authored May 23, 2022
1 parent 77297bb commit 500c367
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 2 deletions.
2 changes: 1 addition & 1 deletion be/src/vec/exec/join/vhash_join_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1093,10 +1093,10 @@ Status HashJoinNode::extract_probe_join_column(Block& block, NullMap& null_map,
auto& col_nullmap = nullable->get_null_map_data();

ignore_null |= !_probe_not_ignore_null[i];
VectorizedUtils::update_null_map(null_map, col_nullmap);
if (_build_not_ignore_null[i]) {
raw_ptrs[i] = nullable;
} else {
VectorizedUtils::update_null_map(null_map, col_nullmap);
raw_ptrs[i] = &col_nested;
}
} else {
Expand Down
8 changes: 8 additions & 0 deletions regression-test/data/query/join/sql/full_join.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
-- This file is automatically generated. You should know what you did if you want to edit this
-- !full_join --
n fj n \N \N
n fj n \N \N

-- !full_join_2 --
n fj n \N \N

11 changes: 11 additions & 0 deletions regression-test/suites/query/join/ddl/full_join_table.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
CREATE TABLE `full_join_table` (
`x` varchar(150) NULL COMMENT ""
) ENGINE=OLAP
UNIQUE KEY(`x`)
COMMENT "OLAP"
DISTRIBUTED BY HASH(`x`) BUCKETS 3
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"in_memory" = "false",
"storage_format" = "V2"
)
16 changes: 16 additions & 0 deletions regression-test/suites/query/join/ddl/table.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
CREATE TABLE `test_bucket_shuffle_join` (
`id` int(11) NOT NULL COMMENT "",
`rectime` datetime NOT NULL COMMENT ""
) ENGINE=OLAP
UNIQUE KEY(`id`, `rectime`)
COMMENT "olap"
PARTITION BY RANGE(`rectime`)
(
PARTITION p202111 VALUES [('2021-11-01 00:00:00'), ('2021-12-01 00:00:00')))
DISTRIBUTED BY HASH(`id`) BUCKETS 10
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"in_memory" = "false",
"storage_format" = "V2"
)

4 changes: 3 additions & 1 deletion regression-test/suites/query/join/load.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
// and modified by Doris.

suite("load") {
def tables=["test_join", "test_bucket_shuffle_join", "table_1", "table_2"]
def tables=["test_join", "full_join_table", "test_bucket_shuffle_join", "table_1", "table_2"]

for (String table in tables) {
sql """ DROP TABLE IF EXISTS $table """
Expand All @@ -37,5 +37,7 @@ suite("load") {
sql """ insert into test_bucket_shuffle_join values(1, "2021-12-01 00:00:00"),
(2, "2021-12-01 00:00:00"), (3, "2021-12-01 00:00:00")"""

sql """ INSERT INTO full_join_table(x) VALUES (NULL) """;

sql """ INSERT INTO table_2 VALUES ('H220427011909850160918','2022-04-27 16:00:33'),('T220427400109910160949','2022-04-27 16:00:54'),('T220427400123770120058','2022-04-27 16:00:56'),('T220427400126530112854','2022-04-27 16:00:34'),('T220427400127160144672','2022-04-27 16:00:10'),('T220427400127900184511','2022-04-27 16:00:34'),('T220427400129940120380','2022-04-27 16:00:23'),('T220427400139720192986','2022-04-27 16:00:34'),('T220427400140260152375','2022-04-27 16:00:02'),('T220427400153170104281','2022-04-27 16:00:31'),('H220427011909800104411','2022-04-27 16:00:14'),('H220427011909870184823','2022-04-27 16:00:36'),('T220427400115770144416','2022-04-27 16:00:12'),('T220427400126390112736','2022-04-27 16:00:19'),('T220427400128350120717','2022-04-27 16:00:56'),('T220427400129680120838','2022-04-27 16:00:39'),('T220427400136970192083','2022-04-27 16:00:51'),('H220427011909770192580','2022-04-27 16:00:04'),('H220427011909820192943','2022-04-27 16:00:23'),('T220427400109110184990','2022-04-27 16:00:29'),('T220427400109930192249','2022-04-27 16:00:56'),('T220427400123050168464','2022-04-27 16:00:37'),('T220427400124330112931','2022-04-27 16:00:56'),('T220427400124430144718','2022-04-27 16:00:07'),('T220427400130570160488','2022-04-27 16:00:34'),('T220427400130610112671','2022-04-27 16:00:30'),('T220427400137600160704','2022-04-27 16:00:35'),('T220427400144590176969','2022-04-27 16:00:49'),('T220427400146320176530','2022-04-27 16:00:34'),('T220427601780480120027','2022-04-27 16:00:58');"""
}
2 changes: 2 additions & 0 deletions regression-test/suites/query/join/sql/full_join.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SELECT 'n fj n', t1.x, t2.x FROM full_join_table AS t1 FULL JOIN full_join_table AS t2 ON t1.x = t2.x ORDER BY t1.x;
SELECT 'n fj n', t1.x, t2.x FROM full_join_table AS t1 FULL JOIN full_join_table AS t2 ON t1.x <=> t2.x ORDER BY t1.x;

0 comments on commit 500c367

Please sign in to comment.