You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by Andrzej <bo...@wp.pl> on 2017/09/27 18:49:40 UTC

Is possible store BINARY data in row: string?

I have big problem:
I have row: address 36 bytes + hasz20 bytes (binary with zeros!) + 4 
bytes index + 1 byte type.
I write:
304d494e454478434f494e42415345303030303030303030303030303030303030300000982051fd1e4ba744bbbe680e1fee14677ba1a3c3540bf7b1cdb606e857233e0e0000000000

and I read:
304d494e454478434f494e42415345303030303030303030303030303030303030300020203c636f310000000000000000000000000000004f494e4241534530303030303030303030

address=0MINEDxCOINBASE0000000000000000000 
hash=0c0068000000000000000000000000000159a670000000000000005109227972 
xio=32767, type=3


only address is correct!
address end with zero byte. Strings with zeros are not correct stored?
I store with:

auto put = std::make_unique<Put>(row);
for (int i = 0; i<qualifiers.size(); i++)
		put->AddColumn(families[i], qualifiers[i], values[i]);
getTable(hTable)->Put(*std::move(put));

and read with:
return string: result->Row()

Re: Is possible store BINARY data in row: string?

Posted by Esteban Gutierrez <es...@cloudera.com>.
Hello Andrzej,

HBase doesn't really care what encoding you use for the key and the value.
This issue is most likely happing on the C++ client or in your application.
If you can reproduce this issue systematically with the C++ client please
feel free to open an upstream JIRA for the HBase project:
https://issues.apache.org/jira/HBASE

Thanks,
esteban.

--
Cloudera, Inc.


On Wed, Sep 27, 2017 at 11:49 AM, Andrzej <bo...@wp.pl> wrote:

> I have big problem:
> I have row: address 36 bytes + hasz20 bytes (binary with zeros!) + 4 bytes
> index + 1 byte type.
> I write:
> 304d494e454478434f494e42415345303030303030303030303030303030
> 303030300000982051fd1e4ba744bbbe680e1fee14677ba1a3c3540bf7b1
> cdb606e857233e0e0000000000
>
> and I read:
> 304d494e454478434f494e42415345303030303030303030303030303030
> 303030300020203c636f310000000000000000000000000000004f494e42
> 41534530303030303030303030
>
> address=0MINEDxCOINBASE0000000000000000000 hash=0c00680000000000000000000
> 00000000159a670000000000000005109227972 xio=32767, type=3
>
>
> only address is correct!
> address end with zero byte. Strings with zeros are not correct stored?
> I store with:
>
> auto put = std::make_unique<Put>(row);
> for (int i = 0; i<qualifiers.size(); i++)
>                 put->AddColumn(families[i], qualifiers[i], values[i]);
> getTable(hTable)->Put(*std::move(put));
>
> and read with:
> return string: result->Row()
>

Re: Is possible store BINARY data in row: string?

Posted by Ted Yu <yu...@gmail.com>.
In simple-client, we have this code:

void ValidateResult(const Result &result, const std::string &row) {

  CHECK(!result.IsEmpty());

  CHECK_EQ(result.Row(), row);

Are you able to reproduce what you described by modifying simple-client
(which results in assertion failure) ?

On Wed, Sep 27, 2017 at 11:49 AM, Andrzej <bo...@wp.pl> wrote:

> I have big problem:
> I have row: address 36 bytes + hasz20 bytes (binary with zeros!) + 4 bytes
> index + 1 byte type.
> I write:
> 304d494e454478434f494e42415345303030303030303030303030303030
> 303030300000982051fd1e4ba744bbbe680e1fee14677ba1a3c3540bf7b1
> cdb606e857233e0e0000000000
>
> and I read:
> 304d494e454478434f494e42415345303030303030303030303030303030
> 303030300020203c636f310000000000000000000000000000004f494e42
> 41534530303030303030303030
>
> address=0MINEDxCOINBASE0000000000000000000 hash=0c00680000000000000000000
> 00000000159a670000000000000005109227972 xio=32767, type=3
>
>
> only address is correct!
> address end with zero byte. Strings with zeros are not correct stored?
> I store with:
>
> auto put = std::make_unique<Put>(row);
> for (int i = 0; i<qualifiers.size(); i++)
>                 put->AddColumn(families[i], qualifiers[i], values[i]);
> getTable(hTable)->Put(*std::move(put));
>
> and read with:
> return string: result->Row()
>