Skip to content
Open
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
3 changes: 2 additions & 1 deletion src/Functions/array/array.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,8 @@ class FunctionArray : public IFunction
const size_t tuple_size = concrete_out_data->tupleSize();
if (tuple_size == 0)
{
out_data.insertManyDefaults(columns.size());
/// Tuple() has no subcolumns to fill. Create `columns.size()` elements per row to match array offsets
out_data.insertManyDefaults(columns.size() * input_rows_count);
}
else
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{((),1):1,((),1):1}
{((),1):1,((),1):1}
{}
{((),1):1,((),1):1}
43 changes: 43 additions & 0 deletions tests/queries/0_stateless/03786_empty_tuple_map_array.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
DROP TABLE IF EXISTS t0;

CREATE TABLE t0 (c0 Map(Tuple(Tuple(), Int), Int))
ENGINE = MergeTree()
ORDER BY tuple();

INSERT INTO TABLE t0 (c0)
VALUES
(
map(
((), 1), 1,
((), 1), 1
)
),
(
map(
((), 1), 1,
((), 1), 1
)
);

SELECT * FROM t0;


DROP TABLE IF EXISTS t1;

CREATE TABLE t1 (c0 Map(Tuple(Tuple(), Int), Int))
ENGINE = MergeTree()
ORDER BY tuple();

INSERT INTO TABLE t1 (c0)
VALUES
(
map()
),
(
map(
((), 1), 1,
((), 1), 1
)
);

SELECT * FROM t1;
Loading