提交 f51b3992 编写于 作者: A Alexey Milovidov

Little better [#CLICKHOUSE-4].

上级 d259c0ea
......@@ -14,6 +14,7 @@ namespace ErrorCodes
{
extern const int LOGICAL_ERROR;
extern const int ILLEGAL_COLUMN;
extern const int SIZES_OF_NESTED_COLUMNS_ARE_INCONSISTENT;
}
......@@ -448,4 +449,12 @@ void ColumnNullable::applyNullMap(const ColumnNullable & other)
applyNullMap(other.getNullMapConcreteColumn());
}
void ColumnNullable::checkConsistency() const
{
if (null_map->size() != nested_column->size())
throw Exception("Logical error: Sizes of nested column and null map of Nullable column are not equal",
ErrorCodes::SIZES_OF_NESTED_COLUMNS_ARE_INCONSISTENT);
}
}
......@@ -90,6 +90,9 @@ public:
void applyNullMap(const ColumnUInt8 & map);
void applyNegatedNullMap(const ColumnUInt8 & map);
/// Check that size of null map equals to size of nested column.
void checkConsistency() const;
private:
ColumnPtr nested_column;
ColumnPtr null_map;
......
......@@ -368,6 +368,7 @@ namespace ErrorCodes
extern const int CANNOT_CREATE_IO_BUFFER = 363;
extern const int RECEIVED_ERROR_TOO_MANY_REQUESTS = 364;
extern const int OUTPUT_IS_NOT_SORTED = 365;
extern const int SIZES_OF_NESTED_COLUMNS_ARE_INCONSISTENT = 366;
extern const int KEEPER_EXCEPTION = 999;
extern const int POCO_EXCEPTION = 1000;
......
......@@ -20,6 +20,7 @@ DataTypeNullable::DataTypeNullable(DataTypePtr nested_data_type_)
void DataTypeNullable::serializeBinaryBulk(const IColumn & column, WriteBuffer & ostr, size_t offset, size_t limit) const
{
const ColumnNullable & col = static_cast<const ColumnNullable &>(column);
col.checkConsistency();
nested_data_type->serializeBinaryBulk(*col.getNestedColumn(), ostr, offset, limit);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册