Skip to content
Open
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
10 changes: 5 additions & 5 deletions src/Processors/Formats/Impl/MsgPackRowInputFormat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -401,11 +401,6 @@ bool MsgPackVisitor::start_array(size_t size) // NOLINT
}
else if (isTuple(removeNullable(info_stack.top().type)))
{
const auto & tuple_type = assert_cast<const DataTypeTuple &>(*removeNullable(info_stack.top().type));
const auto & nested_types = tuple_type.getElements();
if (size != nested_types.size())
throw Exception(ErrorCodes::ILLEGAL_COLUMN, "Cannot insert MessagePack array with size {} into Tuple column with {} elements", size, nested_types.size());

/// If the type is Nullable, reaching start_array means the value
/// is non-null (for nulls, the parser calls visit_nil instead).
/// So we can safely unwrap the Nullable to work with the inner
Expand All @@ -418,6 +413,11 @@ bool MsgPackVisitor::start_array(size_t size) // NOLINT
column_ptr = &nullable_column.getNestedColumn();
}

const auto & tuple_type = assert_cast<const DataTypeTuple &>(*removeNullable(info_stack.top().type));
const auto & nested_types = tuple_type.getElements();
if (size != nested_types.size())
throw Exception(ErrorCodes::ILLEGAL_COLUMN, "Cannot insert MessagePack array with size {} into Tuple column with {} elements", size, nested_types.size());

ColumnTuple & column_tuple = assert_cast<ColumnTuple &>(*column_ptr);
/// Push nested columns into stack in reverse order.
for (ssize_t i = static_cast<ssize_t>(nested_types.size()) - 1; i >= 0; --i)
Expand Down
Loading