You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by md...@orange.com on 2012/04/18 12:02:34 UTC

blob fields, bynary or hexa?

  We're building a database to stock the avatars for our users in three sizes. Thing is,
We planned to use the blob field with a ByteType validator, but if we try to inject the 
binary data as read from the image file, we get a <cannot parse as hex bytes> error. The 
same happens if we convert the binary data to its base64 representation. So far the only 
solutions we found is to actually convert the binary data to its 'string of hexa 
representations of each byte', meaning that each binary byte is actually stocked as two 
'ascii bytes'; or, on the other hand, convert to bas64 and store it in a ascii column.
Did we miss something?

--
Marcos Dione
SysAdmin
Astek Sud-Est
pour FT/TGPF/OPF/PORTAIL/DOP/HEBEX @ Marco Polo
04 97 12 62 45 - mdione.ext@orange.com



_________________________________________________________________________________________________________________________

Ce message et ses pieces jointes peuvent contenir des informations confidentielles ou privilegiees et ne doivent donc
pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce message par erreur, veuillez le signaler
a l'expediteur et le detruire ainsi que les pieces jointes. Les messages electroniques etant susceptibles d'alteration,
France Telecom - Orange decline toute responsabilite si ce message a ete altere, deforme ou falsifie. Merci.

This message and its attachments may contain confidential or privileged information that may be protected by law;
they should not be distributed, used or copied without authorisation.
If you have received this email in error, please notify the sender and delete this message and its attachments.
As emails may be altered, France Telecom - Orange is not liable for messages that have been modified, changed or falsified.
Thank you.


RE: blob fields, bynary or hexa?

Posted by md...@orange.com.
De : mdione.ext@orange.com [mailto:mdione.ext@orange.com]
>   We're building a database to stock the avatars for our users in three
> sizes. Thing is,
> We planned to use the blob field with a ByteType validator

  Before anyone starts pointing out that files in Cassandra is a bad idea, 
the images are no more than 80K in size (we're talking about avatars, after 
all), and this is a proof of concept anyways...

--
Marcos Dione
SysAdmin
Astek Sud-Est
pour FT/TGPF/OPF/PORTAIL/DOP/HEBEX @ Marco Polo
04 97 12 62 45 - mdione.ext@orange.com


_________________________________________________________________________________________________________________________

Ce message et ses pieces jointes peuvent contenir des informations confidentielles ou privilegiees et ne doivent donc
pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce message par erreur, veuillez le signaler
a l'expediteur et le detruire ainsi que les pieces jointes. Les messages electroniques etant susceptibles d'alteration,
France Telecom - Orange decline toute responsabilite si ce message a ete altere, deforme ou falsifie. Merci.

This message and its attachments may contain confidential or privileged information that may be protected by law;
they should not be distributed, used or copied without authorisation.
If you have received this email in error, please notify the sender and delete this message and its attachments.
As emails may be altered, France Telecom - Orange is not liable for messages that have been modified, changed or falsified.
Thank you.


Re: blob fields, bynary or hexa?

Posted by "R. Verlangen" <ro...@us2.nl>.
PHPCassa does support binaries, so that should not be the problem.

2012/4/19 phuduc nguyen <du...@pearson.com>

> Well, I'm not sure exactly how you're passing a blob to the CLI. It would
> be
> helpful if you pasted your commands/code and maybe there is a simple
> oversight.
>
> With that said, Cassandra can most definitely save blob/binary values. I
> think most people use a high level client; we use Hector. If you're in PHP
> land, see if you problems exist in phpcassa.
>
>
> Duc
>
>
>
> On 4/19/12 2:25 AM, "mdione.ext@orange.com" <md...@orange.com> wrote:
>
> > De : phuduc nguyen [mailto:duc.nguyen@pearson.com]
> >> How are you passing a blob or binary stream to the CLI? It sounds like
> >> you're passing in a representation of a binary stream as ascii/UTF8
> >> which will create the problems you describe.
> >
> >   So this is only a limitation of Cassandra-cli?
> >
> > --
> > Marcos Dione
> > SysAdmin
> > Astek Sud-Est
> > pour FT/TGPF/OPF/PORTAIL/DOP/HEBEX @ Marco Polo
> > 04 97 12 62 45 - mdione.ext@orange.com
> >
> >
> ______________________________________________________________________________
> > ___________________________________________
> >
> > Ce message et ses pieces jointes peuvent contenir des informations
> > confidentielles ou privilegiees et ne doivent donc
> > pas etre diffuses, exploites ou copies sans autorisation. Si vous avez
> recu ce
> > message par erreur, veuillez le signaler
> > a l'expediteur et le detruire ainsi que les pieces jointes. Les messages
> > electroniques etant susceptibles d'alteration,
> > France Telecom - Orange decline toute responsabilite si ce message a ete
> > altere, deforme ou falsifie. Merci.
> >
> > This message and its attachments may contain confidential or privileged
> > information that may be protected by law;
> > they should not be distributed, used or copied without authorisation.
> > If you have received this email in error, please notify the sender and
> delete
> > this message and its attachments.
> > As emails may be altered, France Telecom - Orange is not liable for
> messages
> > that have been modified, changed or falsified.
> > Thank you.
> >
>
>


-- 
With kind regards,

Robin Verlangen
www.robinverlangen.nl

Re: blob fields, bynary or hexa?

Posted by phuduc nguyen <du...@pearson.com>.
Well, I'm not sure exactly how you're passing a blob to the CLI. It would be
helpful if you pasted your commands/code and maybe there is a simple
oversight. 

With that said, Cassandra can most definitely save blob/binary values. I
think most people use a high level client; we use Hector. If you're in PHP
land, see if you problems exist in phpcassa.


Duc



On 4/19/12 2:25 AM, "mdione.ext@orange.com" <md...@orange.com> wrote:

> De : phuduc nguyen [mailto:duc.nguyen@pearson.com]
>> How are you passing a blob or binary stream to the CLI? It sounds like
>> you're passing in a representation of a binary stream as ascii/UTF8
>> which will create the problems you describe.
> 
>   So this is only a limitation of Cassandra-cli?
> 
> --
> Marcos Dione
> SysAdmin
> Astek Sud-Est
> pour FT/TGPF/OPF/PORTAIL/DOP/HEBEX @ Marco Polo
> 04 97 12 62 45 - mdione.ext@orange.com
> 
> ______________________________________________________________________________
> ___________________________________________
> 
> Ce message et ses pieces jointes peuvent contenir des informations
> confidentielles ou privilegiees et ne doivent donc
> pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce
> message par erreur, veuillez le signaler
> a l'expediteur et le detruire ainsi que les pieces jointes. Les messages
> electroniques etant susceptibles d'alteration,
> France Telecom - Orange decline toute responsabilite si ce message a ete
> altere, deforme ou falsifie. Merci.
> 
> This message and its attachments may contain confidential or privileged
> information that may be protected by law;
> they should not be distributed, used or copied without authorisation.
> If you have received this email in error, please notify the sender and delete
> this message and its attachments.
> As emails may be altered, France Telecom - Orange is not liable for messages
> that have been modified, changed or falsified.
> Thank you.
> 


RE: blob fields, bynary or hexa?

Posted by md...@orange.com.
De : phuduc nguyen [mailto:duc.nguyen@pearson.com]
> How are you passing a blob or binary stream to the CLI? It sounds like
> you're passing in a representation of a binary stream as ascii/UTF8
> which will create the problems you describe.

  So this is only a limitation of Cassandra-cli?

--
Marcos Dione
SysAdmin
Astek Sud-Est
pour FT/TGPF/OPF/PORTAIL/DOP/HEBEX @ Marco Polo
04 97 12 62 45 - mdione.ext@orange.com

_________________________________________________________________________________________________________________________

Ce message et ses pieces jointes peuvent contenir des informations confidentielles ou privilegiees et ne doivent donc
pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce message par erreur, veuillez le signaler
a l'expediteur et le detruire ainsi que les pieces jointes. Les messages electroniques etant susceptibles d'alteration,
France Telecom - Orange decline toute responsabilite si ce message a ete altere, deforme ou falsifie. Merci.

This message and its attachments may contain confidential or privileged information that may be protected by law;
they should not be distributed, used or copied without authorisation.
If you have received this email in error, please notify the sender and delete this message and its attachments.
As emails may be altered, France Telecom - Orange is not liable for messages that have been modified, changed or falsified.
Thank you.


Re: blob fields, bynary or hexa?

Posted by phuduc nguyen <du...@pearson.com>.
How are you passing a blob or binary stream to the CLI? It sounds like
you're passing in a representation of a binary stream as ascii/UTF8 which
will create the problems you describe.


Regards,
Duc


On 4/18/12 6:08 AM, "mdione.ext@orange.com" <md...@orange.com> wrote:

> De : Erik Forkalsud [mailto:eforkalsrud@cj.com]
>> Which client are you using?  With Hector or straight thrift, your
>> should
>> be able to store byte[] directly.
> 
>   So far, cassandra-cli only, but we're also testing phpcassa with CQL
> support[1].
> 
> --
> [1] https://github.com/thobbs/phpcassa
> --
> Marcos Dione
> SysAdmin
> Astek Sud-Est
> pour FT/TGPF/OPF/PORTAIL/DOP/HEBEX @ Marco Polo
> 04 97 12 62 45 - mdione.ext@orange.com
> 
> ______________________________________________________________________________
> ___________________________________________
> 
> Ce message et ses pieces jointes peuvent contenir des informations
> confidentielles ou privilegiees et ne doivent donc
> pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce
> message par erreur, veuillez le signaler
> a l'expediteur et le detruire ainsi que les pieces jointes. Les messages
> electroniques etant susceptibles d'alteration,
> France Telecom - Orange decline toute responsabilite si ce message a ete
> altere, deforme ou falsifie. Merci.
> 
> This message and its attachments may contain confidential or privileged
> information that may be protected by law;
> they should not be distributed, used or copied without authorisation.
> If you have received this email in error, please notify the sender and delete
> this message and its attachments.
> As emails may be altered, France Telecom - Orange is not liable for messages
> that have been modified, changed or falsified.
> Thank you.
> 


RE: blob fields, bynary or hexa?

Posted by md...@orange.com.
De : Erik Forkalsud [mailto:eforkalsrud@cj.com]
> Which client are you using?  With Hector or straight thrift, your
> should
> be able to store byte[] directly.

  So far, cassandra-cli only, but we're also testing phpcassa with CQL support[1].

--
[1] https://github.com/thobbs/phpcassa
--
Marcos Dione
SysAdmin
Astek Sud-Est
pour FT/TGPF/OPF/PORTAIL/DOP/HEBEX @ Marco Polo
04 97 12 62 45 - mdione.ext@orange.com

_________________________________________________________________________________________________________________________

Ce message et ses pieces jointes peuvent contenir des informations confidentielles ou privilegiees et ne doivent donc
pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce message par erreur, veuillez le signaler
a l'expediteur et le detruire ainsi que les pieces jointes. Les messages electroniques etant susceptibles d'alteration,
France Telecom - Orange decline toute responsabilite si ce message a ete altere, deforme ou falsifie. Merci.

This message and its attachments may contain confidential or privileged information that may be protected by law;
they should not be distributed, used or copied without authorisation.
If you have received this email in error, please notify the sender and delete this message and its attachments.
As emails may be altered, France Telecom - Orange is not liable for messages that have been modified, changed or falsified.
Thank you.


Re: blob fields, bynary or hexa?

Posted by Erik Forkalsud <ef...@cj.com>.
On 04/18/2012 03:02 AM, mdione.ext@orange.com wrote:
>    We're building a database to stock the avatars for our users in three sizes. Thing is,
> We planned to use the blob field with a ByteType validator, but if we try to inject the
> binary data as read from the image file, we get a<cannot parse as hex bytes>  error.

Which client are you using?  With Hector or straight thrift, your should 
be able to store byte[] directly.


- Erik -