From 6df5d556e5af7aa95154374a1d601ac9c52a7dd7 Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Wed, 21 Jun 2017 11:35:38 +0300 Subject: [PATCH] Changed namespace [#DEVTOOLS-3381]. --- contrib/libcityhash/include/city.h | 2 +- contrib/libcityhash/include/citycrc.h | 2 +- contrib/libcityhash/src/city.cc | 4 ++-- .../src/AggregateFunctions/AggregateFunctionUniq.h | 4 ++-- .../AggregateFunctions/AggregateFunctionUniqUpTo.h | 2 +- dbms/src/AggregateFunctions/UniqVariadicHash.h | 8 ++++---- dbms/src/Common/UInt128.h | 4 ++-- dbms/src/Common/tests/hashes_test.cpp | 10 +++++----- dbms/src/Core/StringRef.h | 4 ++-- dbms/src/Functions/FunctionsHashing.h | 14 +++++++------- dbms/src/IO/CompressedReadBufferBase.cpp | 4 ++-- dbms/src/IO/CompressedWriteBuffer.cpp | 2 +- dbms/src/IO/HashingWriteBuffer.h | 6 +++--- dbms/src/IO/tests/hashing_buffer.h | 8 ++++---- dbms/src/IO/tests/hashing_read_buffer.cpp | 2 +- dbms/src/IO/tests/hashing_write_buffer.cpp | 2 +- dbms/src/Interpreters/tests/hash_map_string.cpp | 2 +- dbms/src/Interpreters/tests/hash_map_string_2.cpp | 2 +- dbms/src/Interpreters/tests/hash_map_string_3.cpp | 2 +- dbms/src/Storages/MergeTree/MergeTreeDataPart.h | 2 +- 20 files changed, 43 insertions(+), 43 deletions(-) diff --git a/contrib/libcityhash/include/city.h b/contrib/libcityhash/include/city.h index 3e08a91f2a6..77d4c988cdd 100644 --- a/contrib/libcityhash/include/city.h +++ b/contrib/libcityhash/include/city.h @@ -55,7 +55,7 @@ * - this version of CityHash is exposed in cityHash64 function in ClickHouse SQL language; * - and already used by many users for data ordering, sampling and sharding. */ -namespace CityHash64_v1_0_2 +namespace CityHash_v1_0_2 { typedef uint8_t uint8; diff --git a/contrib/libcityhash/include/citycrc.h b/contrib/libcityhash/include/citycrc.h index d4155a0410d..5f803c60688 100644 --- a/contrib/libcityhash/include/citycrc.h +++ b/contrib/libcityhash/include/citycrc.h @@ -30,7 +30,7 @@ #include -namespace CityHash64_v1_0_2 +namespace CityHash_v1_0_2 { // Hash function for a byte array. diff --git a/contrib/libcityhash/src/city.cc b/contrib/libcityhash/src/city.cc index bc7025dbf40..0cbe4b51af0 100644 --- a/contrib/libcityhash/src/city.cc +++ b/contrib/libcityhash/src/city.cc @@ -71,7 +71,7 @@ using namespace std; #endif #endif -namespace CityHash64_v1_0_2 +namespace CityHash_v1_0_2 { static uint64 UNALIGNED_LOAD64(const char *p) { @@ -363,7 +363,7 @@ uint128 CityHash128(const char *s, size_t len) { #include #include -namespace CityHash64_v1_0_2 +namespace CityHash_v1_0_2 { // Requires len >= 240. diff --git a/dbms/src/AggregateFunctions/AggregateFunctionUniq.h b/dbms/src/AggregateFunctions/AggregateFunctionUniq.h index c52981b554b..eeb7d65d378 100644 --- a/dbms/src/AggregateFunctions/AggregateFunctionUniq.h +++ b/dbms/src/AggregateFunctions/AggregateFunctionUniq.h @@ -266,7 +266,7 @@ struct OneAdder::value>::type * = nullptr) { StringRef value = column.getDataAt(row_num); - data.set.insert(CityHash64_v1_0_2::CityHash64(value.data, value.size)); + data.set.insert(CityHash_v1_0_2::CityHash64(value.data, value.size)); } }; @@ -290,7 +290,7 @@ struct OneAdder::value>::type * = nullptr) { StringRef value = column.getDataAt(row_num); - data.set.insert(CityHash64_v1_0_2::CityHash64(value.data, value.size)); + data.set.insert(CityHash_v1_0_2::CityHash64(value.data, value.size)); } }; diff --git a/dbms/src/AggregateFunctions/AggregateFunctionUniqUpTo.h b/dbms/src/AggregateFunctions/AggregateFunctionUniqUpTo.h index 83c58a111f7..4b2d5d3da21 100644 --- a/dbms/src/AggregateFunctions/AggregateFunctionUniqUpTo.h +++ b/dbms/src/AggregateFunctions/AggregateFunctionUniqUpTo.h @@ -107,7 +107,7 @@ struct AggregateFunctionUniqUpToData : AggregateFunctionUniqUpToData { StringRef value = (*column)->getDataAt(row_num); - hash = CityHash64_v1_0_2::CityHash64(value.data, value.size); + hash = CityHash_v1_0_2::CityHash64(value.data, value.size); ++column; } while (column < columns_end) { StringRef value = (*column)->getDataAt(row_num); - hash = CityHash64_v1_0_2::Hash128to64(CityHash64_v1_0_2::uint128(CityHash64_v1_0_2::CityHash64(value.data, value.size), hash)); + hash = CityHash_v1_0_2::Hash128to64(CityHash_v1_0_2::uint128(CityHash_v1_0_2::CityHash64(value.data, value.size), hash)); ++column; } @@ -68,14 +68,14 @@ struct UniqVariadicHash { StringRef value = column->get()->getDataAt(row_num); - hash = CityHash64_v1_0_2::CityHash64(value.data, value.size); + hash = CityHash_v1_0_2::CityHash64(value.data, value.size); ++column; } while (column < columns_end) { StringRef value = column->get()->getDataAt(row_num); - hash = CityHash64_v1_0_2::Hash128to64(CityHash64_v1_0_2::uint128(CityHash64_v1_0_2::CityHash64(value.data, value.size), hash)); + hash = CityHash_v1_0_2::Hash128to64(CityHash_v1_0_2::uint128(CityHash_v1_0_2::CityHash64(value.data, value.size), hash)); ++column; } diff --git a/dbms/src/Common/UInt128.h b/dbms/src/Common/UInt128.h index 9ea0f6f45ff..84cd74d1ef3 100644 --- a/dbms/src/Common/UInt128.h +++ b/dbms/src/Common/UInt128.h @@ -42,7 +42,7 @@ struct UInt128Hash { size_t operator()(UInt128 x) const { - return CityHash64_v1_0_2::Hash128to64({x.first, x.second}); + return CityHash_v1_0_2::Hash128to64({x.first, x.second}); } }; @@ -122,7 +122,7 @@ struct UInt256Hash size_t operator()(UInt256 x) const { /// NOTE suboptimal - return CityHash64_v1_0_2::Hash128to64({CityHash64_v1_0_2::Hash128to64({x.a, x.b}), CityHash64_v1_0_2::Hash128to64({x.c, x.d})}); + return CityHash_v1_0_2::Hash128to64({CityHash_v1_0_2::Hash128to64({x.a, x.b}), CityHash_v1_0_2::Hash128to64({x.c, x.d})}); } }; diff --git a/dbms/src/Common/tests/hashes_test.cpp b/dbms/src/Common/tests/hashes_test.cpp index 0511d01cc35..219e7dd2a77 100644 --- a/dbms/src/Common/tests/hashes_test.cpp +++ b/dbms/src/Common/tests/hashes_test.cpp @@ -48,12 +48,12 @@ int main(int argc, char ** argv) for (size_t i = 0; i < rows; ++i) { - *reinterpret_cast(&hashes[i * 16]) = CityHash64_v1_0_2::CityHash64(strings[i].data(), strings[i].size()); + *reinterpret_cast(&hashes[i * 16]) = CityHash_v1_0_2::CityHash64(strings[i].data(), strings[i].size()); } watch.stop(); - UInt64 check = CityHash64_v1_0_2::CityHash64(&hashes[0], hashes.size()); + UInt64 check = CityHash_v1_0_2::CityHash64(&hashes[0], hashes.size()); std::cerr << std::fixed << std::setprecision(2) << "CityHash64 (check = " << check << ")" @@ -78,7 +78,7 @@ int main(int argc, char ** argv) watch.stop(); - UInt64 check = CityHash64_v1_0_2::CityHash64(&hashes[0], hashes.size()); + UInt64 check = CityHash_v1_0_2::CityHash64(&hashes[0], hashes.size()); std::cerr << std::fixed << std::setprecision(2) << "SipHash (check = " << check << ")" @@ -99,7 +99,7 @@ int main(int argc, char ** argv) watch.stop(); - UInt64 check = CityHash64_v1_0_2::CityHash64(&hashes[0], hashes.size()); + UInt64 check = CityHash_v1_0_2::CityHash64(&hashes[0], hashes.size()); std::cerr << std::fixed << std::setprecision(2) << "SipHash, stream (check = " << check << ")" @@ -121,7 +121,7 @@ int main(int argc, char ** argv) watch.stop(); - UInt64 check = CityHash64_v1_0_2::CityHash64(&hashes[0], hashes.size()); + UInt64 check = CityHash_v1_0_2::CityHash64(&hashes[0], hashes.size()); std::cerr << std::fixed << std::setprecision(2) << "MD5 (check = " << check << ")" diff --git a/dbms/src/Core/StringRef.h b/dbms/src/Core/StringRef.h index 22666c85adb..3ac5a4dd9ab 100644 --- a/dbms/src/Core/StringRef.h +++ b/dbms/src/Core/StringRef.h @@ -165,7 +165,7 @@ struct StringRefHash64 { size_t operator() (StringRef x) const { - return CityHash64_v1_0_2::CityHash64(x.data, x.size); + return CityHash_v1_0_2::CityHash64(x.data, x.size); } }; @@ -177,7 +177,7 @@ struct StringRefHash64 inline UInt64 hashLen16(UInt64 u, UInt64 v) { - return CityHash64_v1_0_2::Hash128to64(CityHash64_v1_0_2::uint128(u, v)); + return CityHash_v1_0_2::Hash128to64(CityHash_v1_0_2::uint128(u, v)); } inline UInt64 shiftMix(UInt64 val) diff --git a/dbms/src/Functions/FunctionsHashing.h b/dbms/src/Functions/FunctionsHashing.h index 98948764b88..b4ca25288f2 100644 --- a/dbms/src/Functions/FunctionsHashing.h +++ b/dbms/src/Functions/FunctionsHashing.h @@ -638,9 +638,9 @@ struct URLHashImpl { /// do not take last slash, '?' or '#' character into account if (size > 0 && (data[size - 1] == '/' || data[size - 1] == '?' || data[size - 1] == '#')) - return CityHash64_v1_0_2::CityHash64(data, size - 1); + return CityHash_v1_0_2::CityHash64(data, size - 1); - return CityHash64_v1_0_2::CityHash64(data, size); + return CityHash_v1_0_2::CityHash64(data, size); } }; @@ -844,10 +844,10 @@ struct NameIntHash64 { static constexpr auto name = "intHash64"; }; struct ImplCityHash64 { static constexpr auto name = "cityHash64"; - using uint128_t = CityHash64_v1_0_2::uint128; + using uint128_t = CityHash_v1_0_2::uint128; - static auto Hash128to64(const uint128_t & x) { return CityHash64_v1_0_2::Hash128to64(x); } - static auto Hash64(const char * const s, const std::size_t len) { return CityHash64_v1_0_2::CityHash64(s, len); } + static auto Hash128to64(const uint128_t & x) { return CityHash_v1_0_2::Hash128to64(x); } + static auto Hash64(const char * const s, const std::size_t len) { return CityHash_v1_0_2::CityHash64(s, len); } }; struct ImplFarmHash64 @@ -862,9 +862,9 @@ struct ImplFarmHash64 struct ImplMetroHash64 { static constexpr auto name = "metroHash64"; - using uint128_t = CityHash64_v1_0_2::uint128; + using uint128_t = CityHash_v1_0_2::uint128; - static auto Hash128to64(const uint128_t & x) { return CityHash64_v1_0_2::Hash128to64(x); } + static auto Hash128to64(const uint128_t & x) { return CityHash_v1_0_2::Hash128to64(x); } static auto Hash64(const char * const s, const std::size_t len) { union { diff --git a/dbms/src/IO/CompressedReadBufferBase.cpp b/dbms/src/IO/CompressedReadBufferBase.cpp index 338931a7ec9..a33c87f07de 100644 --- a/dbms/src/IO/CompressedReadBufferBase.cpp +++ b/dbms/src/IO/CompressedReadBufferBase.cpp @@ -42,7 +42,7 @@ size_t CompressedReadBufferBase::readCompressedData(size_t & size_decompressed, if (compressed_in->eof()) return 0; - CityHash64_v1_0_2::uint128 checksum; + CityHash_v1_0_2::uint128 checksum; compressed_in->readStrict(reinterpret_cast(&checksum), sizeof(checksum)); own_compressed_buffer.resize(COMPRESSED_BLOCK_HEADER_SIZE); @@ -80,7 +80,7 @@ size_t CompressedReadBufferBase::readCompressedData(size_t & size_decompressed, compressed_in->readStrict(&compressed_buffer[COMPRESSED_BLOCK_HEADER_SIZE], size_compressed - COMPRESSED_BLOCK_HEADER_SIZE); } - if (!disable_checksum && checksum != CityHash64_v1_0_2::CityHash128(&compressed_buffer[0], size_compressed)) + if (!disable_checksum && checksum != CityHash_v1_0_2::CityHash128(&compressed_buffer[0], size_compressed)) throw Exception("Checksum doesn't match: corrupted data.", ErrorCodes::CHECKSUM_DOESNT_MATCH); return size_compressed + sizeof(checksum); diff --git a/dbms/src/IO/CompressedWriteBuffer.cpp b/dbms/src/IO/CompressedWriteBuffer.cpp index c0bdc7faf3e..18f39b2eb0b 100644 --- a/dbms/src/IO/CompressedWriteBuffer.cpp +++ b/dbms/src/IO/CompressedWriteBuffer.cpp @@ -102,7 +102,7 @@ void CompressedWriteBuffer::nextImpl() throw Exception("Unknown compression method", ErrorCodes::UNKNOWN_COMPRESSION_METHOD); } - CityHash64_v1_0_2::uint128 checksum = CityHash64_v1_0_2::CityHash128(compressed_buffer_ptr, compressed_size); + CityHash_v1_0_2::uint128 checksum = CityHash_v1_0_2::CityHash128(compressed_buffer_ptr, compressed_size); out.write(reinterpret_cast(&checksum), sizeof(checksum)); out.write(compressed_buffer_ptr, compressed_size); diff --git a/dbms/src/IO/HashingWriteBuffer.h b/dbms/src/IO/HashingWriteBuffer.h index 2dd717c2d1e..55689fbaec6 100644 --- a/dbms/src/IO/HashingWriteBuffer.h +++ b/dbms/src/IO/HashingWriteBuffer.h @@ -15,7 +15,7 @@ template class IHashingBuffer : public BufferWithOwnMemory { public: - using uint128 = CityHash64_v1_0_2::uint128; + using uint128 = CityHash_v1_0_2::uint128; IHashingBuffer(size_t block_size_ = DBMS_DEFAULT_HASHING_BLOCK_SIZE) : BufferWithOwnMemory(block_size_), block_pos(0), block_size(block_size_), state(0, 0) @@ -25,14 +25,14 @@ public: uint128 getHash() { if (block_pos) - return CityHash64_v1_0_2::CityHash128WithSeed(&BufferWithOwnMemory::memory[0], block_pos, state); + return CityHash_v1_0_2::CityHash128WithSeed(&BufferWithOwnMemory::memory[0], block_pos, state); else return state; } void append(DB::BufferBase::Position data) { - state = CityHash64_v1_0_2::CityHash128WithSeed(data, block_size, state); + state = CityHash_v1_0_2::CityHash128WithSeed(data, block_size, state); } /// computation of the hash depends on the partitioning of blocks diff --git a/dbms/src/IO/tests/hashing_buffer.h b/dbms/src/IO/tests/hashing_buffer.h index 34986a6e449..82efc5a8760 100644 --- a/dbms/src/IO/tests/hashing_buffer.h +++ b/dbms/src/IO/tests/hashing_buffer.h @@ -4,19 +4,19 @@ #define FAIL(msg) { std::cout << msg; exit(1); } -CityHash64_v1_0_2::uint128 referenceHash(const char * data, size_t len) +CityHash_v1_0_2::uint128 referenceHash(const char * data, size_t len) { const size_t block_size = DBMS_DEFAULT_HASHING_BLOCK_SIZE; - CityHash64_v1_0_2::uint128 state(0, 0); + CityHash_v1_0_2::uint128 state(0, 0); size_t pos; for (pos = 0; pos + block_size <= len; pos += block_size) { - state = CityHash64_v1_0_2::CityHash128WithSeed(data + pos, block_size, state); + state = CityHash_v1_0_2::CityHash128WithSeed(data + pos, block_size, state); } if (pos < len) - state = CityHash64_v1_0_2::CityHash128WithSeed(data + pos, len - pos, state); + state = CityHash_v1_0_2::CityHash128WithSeed(data + pos, len - pos, state); return state; } diff --git a/dbms/src/IO/tests/hashing_read_buffer.cpp b/dbms/src/IO/tests/hashing_read_buffer.cpp index 627a96041f0..973127d456b 100644 --- a/dbms/src/IO/tests/hashing_read_buffer.cpp +++ b/dbms/src/IO/tests/hashing_read_buffer.cpp @@ -12,7 +12,7 @@ void test(size_t data_size) for (size_t i = 0; i < data_size; ++i) data[i] = rand() & 255; - CityHash64_v1_0_2::uint128 reference = referenceHash(data, data_size); + CityHash_v1_0_2::uint128 reference = referenceHash(data, data_size); std::vector block_sizes = {56, 128, 513, 2048, 3055, 4097, 4096}; for (size_t read_buffer_block_size : block_sizes) diff --git a/dbms/src/IO/tests/hashing_write_buffer.cpp b/dbms/src/IO/tests/hashing_write_buffer.cpp index 887975fef54..49dc7403747 100644 --- a/dbms/src/IO/tests/hashing_write_buffer.cpp +++ b/dbms/src/IO/tests/hashing_write_buffer.cpp @@ -11,7 +11,7 @@ void test(size_t data_size) for (size_t i = 0; i < data_size; ++i) data[i] = rand() & 255; - CityHash64_v1_0_2::uint128 reference = referenceHash(data, data_size); + CityHash_v1_0_2::uint128 reference = referenceHash(data, data_size); DB::WriteBufferFromFile sink("/dev/null", 1 << 16); diff --git a/dbms/src/Interpreters/tests/hash_map_string.cpp b/dbms/src/Interpreters/tests/hash_map_string.cpp index acbcd69566f..8f2c8075fb6 100644 --- a/dbms/src/Interpreters/tests/hash_map_string.cpp +++ b/dbms/src/Interpreters/tests/hash_map_string.cpp @@ -76,7 +76,7 @@ struct DefaultHash { size_t operator() (CompactStringRef x) const { - return CityHash64_v1_0_2::CityHash64(x.data(), x.size); + return CityHash_v1_0_2::CityHash64(x.data(), x.size); } }; diff --git a/dbms/src/Interpreters/tests/hash_map_string_2.cpp b/dbms/src/Interpreters/tests/hash_map_string_2.cpp index b3b7eecf8b3..81a4caeafa1 100644 --- a/dbms/src/Interpreters/tests/hash_map_string_2.cpp +++ b/dbms/src/Interpreters/tests/hash_map_string_2.cpp @@ -65,7 +65,7 @@ struct DefaultHash \ { \ size_t operator() (STRUCT x) const \ { \ - return CityHash64_v1_0_2::CityHash64(x.data, x.size); \ + return CityHash_v1_0_2::CityHash64(x.data, x.size); \ } \ }; diff --git a/dbms/src/Interpreters/tests/hash_map_string_3.cpp b/dbms/src/Interpreters/tests/hash_map_string_3.cpp index 0580775c8a4..39206024eda 100644 --- a/dbms/src/Interpreters/tests/hash_map_string_3.cpp +++ b/dbms/src/Interpreters/tests/hash_map_string_3.cpp @@ -68,7 +68,7 @@ struct DefaultHash \ { \ size_t operator() (STRUCT x) const \ { \ - return CityHash64_v1_0_2::CityHash64(x.data, x.size); \ + return CityHash_v1_0_2::CityHash64(x.data, x.size); \ } \ }; diff --git a/dbms/src/Storages/MergeTree/MergeTreeDataPart.h b/dbms/src/Storages/MergeTree/MergeTreeDataPart.h index 5a865f7878f..8959211d046 100644 --- a/dbms/src/Storages/MergeTree/MergeTreeDataPart.h +++ b/dbms/src/Storages/MergeTree/MergeTreeDataPart.h @@ -16,7 +16,7 @@ namespace DB /// Checksum of one file. struct MergeTreeDataPartChecksum { - using uint128 = CityHash64_v1_0_2::uint128; + using uint128 = CityHash_v1_0_2::uint128; size_t file_size {}; uint128 file_hash {};