Fixed error with NULLs [#CLICKHOUSE-2901].

This commit is contained in:
Alexey Milovidov 2017-03-24 07:42:36 +03:00
parent 02c2bb926f
commit e6a41a0256
3 changed files with 7 additions and 1 deletions

View File

@ -171,7 +171,7 @@ void IMergedBlockOutputStream::writeDataImpl(
writeIntBinary(stream.compressed.offset(), stream.marks);
}
DataTypeUInt8{}.serializeBinaryBulk(nullable_col.getNullMapConcreteColumn(), stream.compressed, 0, 0);
DataTypeUInt8{}.serializeBinaryBulk(nullable_col.getNullMapConcreteColumn(), stream.compressed, prev_mark, limit);
/// This way that instead of the marks pointing to the end of the compressed block, there were marks pointing to the beginning of the next one.
stream.compressed.nextIfAtEnd();

View File

@ -0,0 +1 @@
1000

View File

@ -0,0 +1,5 @@
DROP TABLE IF EXISTS test.nulls;
CREATE TABLE test.nulls (d Date, x Nullable(UInt64)) ENGINE = MergeTree(d, d, 8192);
INSERT INTO test.nulls SELECT toDate('2000-01-01'), number % 10 != 0 ? number : NULL FROM system.numbers LIMIT 10000;
SELECT count() FROM test.nulls WHERE x IS NULL;
DROP TABLE test.nulls;