Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion be/src/vec/exprs/table_function/vexplode_v2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ int VExplodeV2TableFunction::get_value(MutableColumnPtr& column, int max_step) {
} else {
nullmap_column->insert_many_defaults(max_step);
}
} else {
} else if (element_size > _cur_offset) {
auto current_insert_num = element_size - _cur_offset;
nullable_column->get_nested_column_ptr()->insert_range_from(
*detail.nested_col, pos, current_insert_num);
Expand All @@ -242,6 +242,8 @@ int VExplodeV2TableFunction::get_value(MutableColumnPtr& column, int max_step) {
nullmap_column->insert_many_defaults(current_insert_num);
}
nullable_column->insert_many_defaults(max_step - current_insert_num);
} else {
nullable_column->insert_many_defaults(max_step);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -675,3 +675,75 @@
3 116 \N 115 \N
3 116 \N 116 \N

-- !test24 --
a \N \N \N 4
a \N \N \N 5
a \N \N ef 1
a \N 1 ab \N
a \N 2 cd \N
a \N 4 \N 2
a \N 5 \N 3
b \N \N \N 4
b \N \N \N 5
b \N \N ef 1
b \N 1 ab \N
b \N 2 cd \N
b \N 4 \N 2
b \N 5 \N 3
c \N \N \N 4
c \N \N \N 5
c \N \N ef 1
c \N 1 ab \N
c \N 2 cd \N
c \N 4 \N 2
c \N 5 \N 3
d \N \N \N 4
d \N \N \N 5
d \N \N ef 1
d \N 1 ab \N
d \N 2 cd \N
d \N 4 \N 2
d \N 5 \N 3
e \N \N \N 4
e \N \N \N 5
e \N \N ef 1
e \N 1 ab \N
e \N 2 cd \N
e \N 4 \N 2
e \N 5 \N 3
f \N \N \N 4
f \N \N \N 5
f \N \N ef 1
f \N 1 ab \N
f \N 2 cd \N
f \N 4 \N 2
f \N 5 \N 3
g \N \N \N 4
g \N \N \N 5
g \N \N ef 1
g \N 1 ab \N
g \N 2 cd \N
g \N 4 \N 2
g \N 5 \N 3
h \N \N \N 4
h \N \N \N 5
h \N \N ef 1
h \N 1 ab \N
h \N 2 cd \N
h \N 4 \N 2
h \N 5 \N 3
i \N \N \N 4
i \N \N \N 5
i \N \N ef 1
i \N 1 ab \N
i \N 2 cd \N
i \N 4 \N 2
i \N 5 \N 3
j \N \N \N 4
j \N \N \N 5
j \N \N ef 1
j \N 1 ab \N
j \N 2 cd \N
j \N 4 \N 2
j \N 5 \N 3

Original file line number Diff line number Diff line change
Expand Up @@ -188,4 +188,29 @@ suite("explode") {
qt_test22 "select id,e1,e2,e3 from array_test as a lateral view explode_variant_array(a.v_string['a'],a.v_int['a'],a.v_int['a']) tmp1 as e1,e2,e3;"
qt_test23 "select id,e1,e2,e11,e12 from array_test as a lateral view explode_variant_array(a.v_int['a'],a.v_string['a']) tmp1 as e1,e2 lateral view explode_variant_array(a.v_int['a'],a.v_string['a']) tmp2 as e11,e12;"

sql "DROP TABLE IF EXISTS array_test2;"
sql """
CREATE TABLE `array_test2` (
`v` varchar(10)
) DISTRIBUTED BY RANDOM BUCKETS 1
PROPERTIES (
"replication_allocation" = "tag.location.default: 1"
);
"""

sql """
insert into array_test2 values
("a"), ("b"), ("c"), ("d"), ("e"),
("f"), ("g"), ("h"), ("i"), ("j");
"""

sql "set batch_size = 16"

qt_test24 """
select
*
from array_test2
lateral view explode([], [1, 2, null, 4, 5], ["ab", "cd", "ef"], [null, null, 1, 2, 3, 4, 5]) t2 as c0, c1, c2, c3
order by 1,2,3,4,5;
"""
}
Loading