mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Merge pull request #7234 from ClickHouse/aku/null-field-serialization
Serialize Null Fields correctly in DataTypeNullable.
This commit is contained in:
commit
9b2e025918
@ -119,6 +119,33 @@ void DataTypeNullable::deserializeBinaryBulkWithMultipleStreams(
|
||||
}
|
||||
|
||||
|
||||
void DataTypeNullable::serializeBinary(const Field & field, WriteBuffer & ostr) const
|
||||
{
|
||||
if (field.isNull())
|
||||
{
|
||||
writeBinary(true, ostr);
|
||||
}
|
||||
else
|
||||
{
|
||||
writeBinary(false, ostr);
|
||||
nested_data_type->serializeBinary(field, ostr);
|
||||
}
|
||||
}
|
||||
|
||||
void DataTypeNullable::deserializeBinary(Field & field, ReadBuffer & istr) const
|
||||
{
|
||||
bool is_null = false;
|
||||
readBinary(is_null, istr);
|
||||
if (!is_null)
|
||||
{
|
||||
nested_data_type->deserializeBinary(field, istr);
|
||||
}
|
||||
else
|
||||
{
|
||||
field = Null();
|
||||
}
|
||||
}
|
||||
|
||||
void DataTypeNullable::serializeBinary(const IColumn & column, size_t row_num, WriteBuffer & ostr) const
|
||||
{
|
||||
const ColumnNullable & col = assert_cast<const ColumnNullable &>(column);
|
||||
|
@ -45,8 +45,8 @@ public:
|
||||
DeserializeBinaryBulkSettings & settings,
|
||||
DeserializeBinaryBulkStatePtr & state) const override;
|
||||
|
||||
void serializeBinary(const Field & field, WriteBuffer & ostr) const override { nested_data_type->serializeBinary(field, ostr); }
|
||||
void deserializeBinary(Field & field, ReadBuffer & istr) const override { nested_data_type->deserializeBinary(field, istr); }
|
||||
void serializeBinary(const Field & field, WriteBuffer & ostr) const override;
|
||||
void deserializeBinary(Field & field, ReadBuffer & istr) const override;
|
||||
void serializeBinary(const IColumn & column, size_t row_num, WriteBuffer & ostr) const override;
|
||||
void deserializeBinary(IColumn & column, ReadBuffer & istr) const override;
|
||||
void serializeTextEscaped(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings &) const override;
|
||||
|
@ -0,0 +1,5 @@
|
||||
-- this test checks that null values are correctly serialized inside minmax index (issue #7113)
|
||||
drop table if exists null_01016;
|
||||
create table if not exists null_01016 (x Nullable(String)) engine MergeTree order by ifNull(x, 'order-null') partition by ifNull(x, 'partition-null');
|
||||
insert into null_01016 values (null);
|
||||
drop table null_01016;
|
Loading…
Reference in New Issue
Block a user