diff --git a/src/DataTypes/Serializations/SerializationSparse.cpp b/src/DataTypes/Serializations/SerializationSparse.cpp index dd39d51b409..80e55ec19e1 100644 --- a/src/DataTypes/Serializations/SerializationSparse.cpp +++ b/src/DataTypes/Serializations/SerializationSparse.cpp @@ -6,6 +6,7 @@ #include #include #include +#include namespace DB { @@ -13,7 +14,7 @@ namespace DB namespace { -static constexpr auto END_OF_GRANULE_FLAG = 1ULL << 63; +static constexpr auto END_OF_GRANULE_FLAG = 1ULL << 62; struct DeserializeStateSparse : public ISerialization::DeserializeBinaryBulkState { @@ -34,13 +35,13 @@ void serializeOffsets(const IColumn::Offsets & offsets, WriteBuffer & ostr, size for (size_t i = 0; i < size; ++i) { size_t group_size = offsets[i] - start; - writeIntBinary(group_size, ostr); + writeVarUInt(group_size, ostr); start += group_size + 1; } size_t group_size = start < end ? end - start : 0; group_size |= END_OF_GRANULE_FLAG; - writeIntBinary(group_size, ostr); + writeVarUInt(group_size, ostr); } size_t deserializeOffsets(IColumn::Offsets & offsets, @@ -70,7 +71,7 @@ size_t deserializeOffsets(IColumn::Offsets & offsets, size_t group_size; while (!istr.eof()) { - readIntBinary(group_size, istr); + readVarUInt(group_size, istr); bool end_of_granule = group_size & END_OF_GRANULE_FLAG; group_size &= ~END_OF_GRANULE_FLAG; diff --git a/src/Storages/MergeTree/MergeTreeSettings.h b/src/Storages/MergeTree/MergeTreeSettings.h index b9d9f1473ef..4e877980f1d 100644 --- a/src/Storages/MergeTree/MergeTreeSettings.h +++ b/src/Storages/MergeTree/MergeTreeSettings.h @@ -33,7 +33,7 @@ struct Settings; M(UInt64, min_rows_for_compact_part, 0, "Experimental. Minimal number of rows to create part in compact format instead of saving it in RAM", 0) \ M(Bool, in_memory_parts_enable_wal, true, "Whether to write blocks in Native format to write-ahead-log before creation in-memory part", 0) \ M(UInt64, write_ahead_log_max_bytes, 1024 * 1024 * 1024, "Rotate WAL, if it exceeds that amount of bytes", 0) \ - M(Float, ratio_for_sparse_serialization, 0, "", 0) \ + M(Float, ratio_for_sparse_serialization, 1.1, "", 0) \ \ /** Merge settings. */ \ M(UInt64, merge_max_block_size, DEFAULT_MERGE_BLOCK_SIZE, "How many rows in blocks should be formed for merge operations.", 0) \