mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-15 19:02:04 +00:00
Fix bloom filter serialization endian issue for s390x
This commit is contained in:
parent
6fcee9df85
commit
8f7970d598
@ -96,6 +96,10 @@ void MergeTreeIndexGranuleBloomFilter::deserializeBinary(ReadBuffer & istr, Merg
|
|||||||
static size_t atom_size = 8;
|
static size_t atom_size = 8;
|
||||||
size_t bytes_size = (bits_per_row * total_rows + atom_size - 1) / atom_size;
|
size_t bytes_size = (bits_per_row * total_rows + atom_size - 1) / atom_size;
|
||||||
filter = std::make_shared<BloomFilter>(bytes_size, hash_functions, 0);
|
filter = std::make_shared<BloomFilter>(bytes_size, hash_functions, 0);
|
||||||
|
|
||||||
|
#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
||||||
|
bytes_size = std::max(atom_size, bytes_size);
|
||||||
|
#endif
|
||||||
istr.readStrict(reinterpret_cast<char *>(filter->getFilter().data()), bytes_size);
|
istr.readStrict(reinterpret_cast<char *>(filter->getFilter().data()), bytes_size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -107,7 +111,11 @@ void MergeTreeIndexGranuleBloomFilter::serializeBinary(WriteBuffer & ostr) const
|
|||||||
|
|
||||||
static size_t atom_size = 8;
|
static size_t atom_size = 8;
|
||||||
writeVarUInt(total_rows, ostr);
|
writeVarUInt(total_rows, ostr);
|
||||||
|
#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
||||||
|
size_t bytes_size = std::max(atom_size, (bits_per_row * total_rows + atom_size - 1) / atom_size);
|
||||||
|
#else
|
||||||
size_t bytes_size = (bits_per_row * total_rows + atom_size - 1) / atom_size;
|
size_t bytes_size = (bits_per_row * total_rows + atom_size - 1) / atom_size;
|
||||||
|
#endif
|
||||||
for (const auto & bloom_filter : bloom_filters)
|
for (const auto & bloom_filter : bloom_filters)
|
||||||
ostr.write(reinterpret_cast<const char *>(bloom_filter->getFilter().data()), bytes_size);
|
ostr.write(reinterpret_cast<const char *>(bloom_filter->getFilter().data()), bytes_size);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user