-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BugFix] Do not reuse input null and offset column for array_map (#44226
) Signed-off-by: zihe.liu <[email protected]> (cherry picked from commit 70db73d) # Conflicts: # be/src/exprs/vectorized/array_map_expr.cpp
- Loading branch information
1 parent
4c9ff36
commit 0057df6
Showing
3 changed files
with
145 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
-- name: test_array_map_1 | ||
CREATE TABLE t1 ( | ||
k1 bigint, | ||
c1 array < varchar(65536) > | ||
) ENGINE = OLAP | ||
DUPLICATE KEY(k1) PROPERTIES ( | ||
"replication_num" = "1" | ||
); | ||
-- result: | ||
-- !result | ||
CREATE TABLE t2 ( | ||
k1 bigint, | ||
c1 bigint | ||
) ENGINE = OLAP | ||
DUPLICATE KEY(k1) PROPERTIES ( | ||
"replication_num" = "1" | ||
); | ||
-- result: | ||
-- !result | ||
insert into t1 | ||
values | ||
(1, ["1","2"] ), | ||
(2, ["0","2","1"] ), | ||
(3, ["0","2","1"] ), | ||
(4, ["1","2"] ), | ||
(5, ["0","2","1"] ), | ||
(6, ["0","2","1","1"]), | ||
(7, ["0","2","1"] ), | ||
(8, ["1","2"] ), | ||
(9, ["L","2","1"] ), | ||
(10, ["1","2"] ); | ||
-- result: | ||
-- !result | ||
insert into t2 | ||
values | ||
(1, 1), | ||
(2, 1), | ||
(3, 3), | ||
(4, 5); | ||
-- result: | ||
-- !result | ||
with w1 as ( | ||
select | ||
k1, c1, array_map (x -> true, c1) as c2 | ||
from | ||
t1 | ||
) | ||
select | ||
w1.* | ||
from | ||
w1 | ||
join [broadcast] t2 using(k1) | ||
where | ||
array_sum(w1.c1) <= t2.c1 | ||
order by | ||
w1.k1; | ||
-- result: | ||
3 ["0","2","1"] [1,1,1] | ||
4 ["1","2"] [1,1] | ||
-- !result |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
-- name: test_array_map_1 | ||
|
||
-- Prepare Table and Data. | ||
CREATE TABLE t1 ( | ||
k1 bigint, | ||
c1 array < varchar(65536) > | ||
) ENGINE = OLAP | ||
DUPLICATE KEY(k1) PROPERTIES ( | ||
"replication_num" = "1" | ||
); | ||
|
||
CREATE TABLE t2 ( | ||
k1 bigint, | ||
c1 bigint | ||
) ENGINE = OLAP | ||
DUPLICATE KEY(k1) PROPERTIES ( | ||
"replication_num" = "1" | ||
); | ||
|
||
insert into t1 | ||
values | ||
(1, ["1","2"] ), | ||
(2, ["0","2","1"] ), | ||
(3, ["0","2","1"] ), | ||
(4, ["1","2"] ), | ||
(5, ["0","2","1"] ), | ||
(6, ["0","2","1","1"]), | ||
(7, ["0","2","1"] ), | ||
(8, ["1","2"] ), | ||
(9, ["L","2","1"] ), | ||
(10, ["1","2"] ); | ||
|
||
|
||
insert into t2 | ||
values | ||
(1, 1), | ||
(2, 1), | ||
(3, 3), | ||
(4, 5); | ||
|
||
-- Query. | ||
with w1 as ( | ||
select | ||
k1, c1, array_map (x -> true, c1) as c2 | ||
from | ||
t1 | ||
) | ||
select | ||
w1.* | ||
from | ||
w1 | ||
join [broadcast] t2 using(k1) | ||
where | ||
array_sum(w1.c1) <= t2.c1 | ||
order by | ||
w1.k1; | ||
|