hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrzej <borucki_andr...@wp.pl>
Subject Re: Questions about my bitcoin table
Date Tue, 05 Sep 2017 11:17:41 GMT
W dniu 26.08.2017 o 16:02, Ted Yu pisze:
>      auto int_val = hbase::BytesUtil::ToInt64(*(result->Value(family, > incrPrefix
+ col)));

There is in load-client.cc

In method BytesUtil::ToInt64 is:

int64_t BytesUtil::ToInt64(std::string str) {
   if (str.length() < 8) {
     throw std::runtime_error("There are not enough bytes. Expected: 8, 
actual: " + str.length());
   }
   const unsigned char *bytes = reinterpret_cast<unsigned char 
*>(const_cast<char *>(str.c_str()));
   int64_t l = 0;
   for (int i = 0; i < 8; i++) {
     l <<= 8;
     l ^= bytes[i];
   }
   return l;
}

This means that is possible retrieve any binary data from string, 
including not utf-8 chars and \0 char ?

Similar, put->AddColumn(family, qualifier, value) can add any binary 
data as value casting it to char?

In example simple-test.cc was error when trying put empty string.

Mime
View raw message