16 #ifndef IMPALA_UTIL_UID_UTIL_H
17 #define IMPALA_UTIL_UID_UTIL_H
19 #include <boost/uuid/uuid.hpp>
20 #include <boost/uuid/uuid_generators.hpp>
22 #include "gen-cpp/Types_types.h"
28 inline std::size_t
hash_value(
const impala::TUniqueId&
id) {
30 boost::hash_combine(seed,
id.lo);
31 boost::hash_combine(seed,
id.hi);
39 memcpy(&(unique_id->hi), &uuid.data[0], 8);
40 memcpy(&(unique_id->lo), &uuid.data[8], 8);
43 template <
typename F,
typename T>
53 boost::uuids::basic_random_generator<boost::mt19937> gen;
54 boost::uuids::uuid u = gen();
55 string uuid(u.begin(), u.end());
63 memcpy(&uid.hi, &u[0],
sizeof(int64_t));
64 memcpy(&uid.lo, &u[0] +
sizeof(int64_t),
sizeof(int64_t));
T CastTUniqueId(const F &from)
TUniqueId GenerateUUID()
generates a 16 byte UUID
std::size_t hash_value(const Decimal4Value &v)
This function must be called 'hash_value' to be picked up by boost.
string GenerateUUIDString()
generates a 16 byte UUID
void UUIDToTUniqueId(const boost::uuids::uuid &uuid, T *unique_id)