You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Brian O'Neill <bo...@alumni.brown.edu> on 2013/04/11 14:21:33 UTC

Blobs in CQL?

I started playing around with the CQL driver.
Has anyone used blobs with it yet?

Are you forced to convert a byte[] to hex?
(e.g. I have a photo that I want to store in C* using the java-driver API)

-brian

-- 
Brian ONeill
Lead Architect, Health Market Science (http://healthmarketscience.com)
mobile:215.588.6024
blog: http://brianoneill.blogspot.com/
twitter: @boneill42

Re: Blobs in CQL?

Posted by Mikhail Mazursky <as...@gmail.com>.
Hi,

let me ask a related question. Is it planned to support passing InputStream
or Guava's InputSupplier<InputStream>/ByteSource to BoundStatement to make
it possible to take advantage of new native transport's streaming?

p.s. the new driver looks cool, but I haven't tried it yet.

Mikhail.

Re: Blobs in CQL?

Posted by Brian O'Neill <bo...@alumni.brown.edu>.
Bingo! Thanks to both of you.  (the C* community rocks)

A few hours worth of work, and I've got a working REST-based photo
repository backed by  C* using the CQL java driver. =)

rock on, thanks again,
-brian


On Thu, Apr 11, 2013 at 9:33 AM, Sylvain Lebresne <sy...@datastax.com>wrote:

>
> I assume I'm doing something wrong in the select.  Am I incorrectly using
>> the ResultSet?
>>
>
> You're incorrectly using the returned ByteBuffer. But you should not feel
> bad, that API kinda
> sucks.
>
> The short version is that .array() returns the backing array of the
> ByteBuffer. But there is no
> guarantee that you'll have a one-to-one correspondence between the valid
> content of the
> ByteBuffer and the backing array, the backing array can be bigger in
> particular (long story short,
> this allows multiple ByteBuffer to share the same backing array, which can
> avoid doing copies).
>
> I also note that there is no guarantee that .array() will work unless
> you've called .hasArray().
>
> Anyway, what you could do is:
> ByteBuffer bb = resultSet.one().getBytes("data");
> byte[] data = new byte[bb.remaining()];
> bb.get(data);
>
> Alternatively, you can use the result of .array(), but you should only
> consider the bb.remaining()
> bytes starting at bb.arrayOffset() + bb.position() (where bb is the
> returned ByteBuffer).
>
> --
> Sylvain
>
>
>
>>
>> -brian
>>
>> On Thu, Apr 11, 2013 at 9:09 AM, Brian O'Neill <bo...@alumni.brown.edu>wrote:
>>
>>> Yep, it worked like a charm.  (PreparedStatement avoided the hex
>>> conversion)
>>>
>>> But now, I'm seeing a few extra bytes come back in the select….
>>> (I'll keep digging, but maybe you have some insight?)
>>>
>>> I see this:
>>>
>>> ERROR [2013-04-11 13:05:03,461] com.skookle.dao.RepositoryDao:
>>> repository.add() byte.length()=[259804]
>>>
>>> ERROR [2013-04-11 13:08:08,487] com.skookle.dao.RepositoryDao:
>>> repository.get() [foo.jpeg] byte.length()=[259861]
>>>
>>> (Notice the length's don't match up)
>>>
>>> Using this code:
>>>
>>>     public void addContent(String key, byte[] data)
>>>
>>>             throws NoHostAvailableException {
>>>
>>>         LOG.error("repository.add() byte.length()=[" + data.length + "]"
>>> );
>>>
>>>         String statement = "INSERT INTO " + KEYSPACE + "." + TABLE + "(key,
>>> data) VALUES (?, ?)";
>>>
>>>         PreparedStatement ps = session.prepare(statement);
>>>
>>>         BoundStatement bs = ps.bind(key, ByteBuffer.wrap(data));
>>>
>>>         session.execute(bs);
>>>
>>>     }
>>>
>>>
>>>     public byte[] getContent(String key) throwsNoHostAvailableException {
>>>
>>>         Query select = select("data").from(KEYSPACE, TABLE).where(eq(
>>> "key", key));
>>>
>>>         ResultSet resultSet = session.execute(select);
>>>
>>>         byte[] data = resultSet.one().getBytes("data").array();
>>>
>>>         LOG.error("repository.get() [" + key + "] byte.length()=[" +
>>> data.length + "]");
>>>
>>>         return data;
>>>
>>>     }
>>>
>>> ---
>>>
>>> Brian O'Neill
>>>
>>> Lead Architect, Software Development
>>>
>>> *Health Market Science*
>>>
>>> *The Science of Better Results*
>>>
>>> 2700 Horizon Drive • King of Prussia, PA • 19406****
>>>
>>> M: 215.588.6024 • @boneill42 <http://www.twitter.com/boneill42>  •
>>>
>>> healthmarketscience.com
>>>
>>>
>>> This information transmitted in this email message is for the intended
>>> recipient only and may contain confidential and/or privileged material. If
>>> you received this email in error and are not the intended recipient, or the
>>> person responsible to deliver it to the intended recipient, please contact
>>> the sender at the email above and delete this email and any attachments and
>>> destroy any copies thereof. Any review, retransmission, dissemination,
>>> copying or other use of, or taking any action in reliance upon, this
>>> information by persons or entities other than the intended recipient is
>>> strictly prohibited.****
>>>
>>> ** **
>>>
>>>
>>> From: Sylvain Lebresne <sy...@datastax.com>
>>> Reply-To: <us...@cassandra.apache.org>
>>> Date: Thursday, April 11, 2013 8:48 AM
>>> To: "user@cassandra.apache.org" <us...@cassandra.apache.org>
>>> Cc: Gabriel Ciuloaica <gc...@gmail.com>
>>> Subject: Re: Blobs in CQL?
>>>
>>>
>>> Hopefully, the prepared statement doesn't do the conversion.
>>>>
>>>
>>> It does not.
>>>
>>>
>>>> (I'm not sure if it is a limitation of the CQL protocol itself)
>>>>
>>>> thanks again,
>>>> -brian
>>>>
>>>>
>>>>
>>>> ---
>>>> Brian O'Neill
>>>> Lead Architect, Software Development
>>>> Health Market Science
>>>> The Science of Better Results
>>>> 2700 Horizon Drive • King of Prussia, PA • 19406
>>>> M: 215.588.6024 • @boneill42 <http://www.twitter.com/boneill42>  •
>>>> healthmarketscience.com
>>>>
>>>> This information transmitted in this email message is for the intended
>>>> recipient only and may contain confidential and/or privileged material.
>>>> If
>>>> you received this email in error and are not the intended recipient, or
>>>> the person responsible to deliver it to the intended recipient, please
>>>> contact the sender at the email above and delete this email and any
>>>> attachments and destroy any copies thereof. Any review, retransmission,
>>>> dissemination, copying or other use of, or taking any action in reliance
>>>> upon, this information by persons or entities other than the intended
>>>> recipient is strictly prohibited.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> On 4/11/13 8:34 AM, "Gabriel Ciuloaica" <gc...@gmail.com> wrote:
>>>>
>>>> >I'm not using the query builder but the PreparedStatement.
>>>> >
>>>> >Here is the sample code: https://gist.github.com/devsprint/5363023
>>>> >
>>>> >Gabi
>>>> >On 4/11/13 3:27 PM, Brian O'Neill wrote:
>>>> >> Great!
>>>> >>
>>>> >> Thanks Gabriel.  Do you have an example? (are using QueryBuilder?)
>>>> >> I couldn't find the part of  the API that allowed you to pass in the
>>>> >>byte
>>>> >> array.
>>>> >>
>>>> >> -brian
>>>> >>
>>>> >> ---
>>>> >> Brian O'Neill
>>>> >> Lead Architect, Software Development
>>>> >> Health Market Science
>>>> >> The Science of Better Results
>>>> >> 2700 Horizon Drive € King of Prussia, PA € 19406
>>>> >> M: 215.588.6024 € @boneill42 <http://www.twitter.com/boneill42>  €
>>>> >> healthmarketscience.com
>>>> >>
>>>> >> This information transmitted in this email message is for the
>>>> intended
>>>> >> recipient only and may contain confidential and/or privileged
>>>> material.
>>>> >>If
>>>> >> you received this email in error and are not the intended recipient,
>>>> or
>>>> >> the person responsible to deliver it to the intended recipient,
>>>> please
>>>> >> contact the sender at the email above and delete this email and any
>>>> >> attachments and destroy any copies thereof. Any review,
>>>> retransmission,
>>>> >> dissemination, copying or other use of, or taking any action in
>>>> reliance
>>>> >> upon, this information by persons or entities other than the intended
>>>> >> recipient is strictly prohibited.
>>>> >>
>>>> >>
>>>> >>
>>>> >>
>>>> >>
>>>> >>
>>>> >>
>>>> >> On 4/11/13 8:25 AM, "Gabriel Ciuloaica" <gc...@gmail.com>
>>>> wrote:
>>>> >>
>>>> >>> Hi Brian,
>>>> >>>
>>>> >>> I'm using the blobs to store images in cassandra(1.2.3) using the
>>>> >>> java-driver version 1.0.0-beta1.
>>>> >>> There is no need to convert a byte array into hex.
>>>> >>>
>>>> >>> Br,
>>>> >>> Gabi
>>>> >>>
>>>> >>> On 4/11/13 3:21 PM, Brian O'Neill wrote:
>>>> >>>> I started playing around with the CQL driver.
>>>> >>>> Has anyone used blobs with it yet?
>>>> >>>>
>>>> >>>> Are you forced to convert a byte[] to hex?
>>>> >>>> (e.g. I have a photo that I want to store in C* using the
>>>> java-driver
>>>> >>>> API)
>>>> >>>>
>>>> >>>> -brian
>>>> >>>>
>>>> >>>> --
>>>> >>>> Brian ONeill
>>>> >>>> Lead Architect, Health Market Science (
>>>> http://healthmarketscience.com)
>>>> >>>> mobile:215.588.6024
>>>> >>>> blog: http://brianoneill.blogspot.com/
>>>> >>>> twitter: @boneill42
>>>> >>
>>>> >
>>>>
>>>>
>>>>
>>>
>>
>>
>> --
>> Brian ONeill
>> Lead Architect, Health Market Science (http://healthmarketscience.com)
>>
>> mobile:215.588.6024
>> blog: http://brianoneill.blogspot.com/
>> twitter: @boneill42
>>
>
>


-- 
Brian ONeill
Lead Architect, Health Market Science (http://healthmarketscience.com)

mobile:215.588.6024
blog: http://brianoneill.blogspot.com/
twitter: @boneill42

Re: Blobs in CQL?

Posted by Sylvain Lebresne <sy...@datastax.com>.
> I assume I'm doing something wrong in the select.  Am I incorrectly using
> the ResultSet?
>

You're incorrectly using the returned ByteBuffer. But you should not feel
bad, that API kinda
sucks.

The short version is that .array() returns the backing array of the
ByteBuffer. But there is no
guarantee that you'll have a one-to-one correspondence between the valid
content of the
ByteBuffer and the backing array, the backing array can be bigger in
particular (long story short,
this allows multiple ByteBuffer to share the same backing array, which can
avoid doing copies).

I also note that there is no guarantee that .array() will work unless
you've called .hasArray().

Anyway, what you could do is:
ByteBuffer bb = resultSet.one().getBytes("data");
byte[] data = new byte[bb.remaining()];
bb.get(data);

Alternatively, you can use the result of .array(), but you should only
consider the bb.remaining()
bytes starting at bb.arrayOffset() + bb.position() (where bb is the
returned ByteBuffer).

--
Sylvain



>
> -brian
>
> On Thu, Apr 11, 2013 at 9:09 AM, Brian O'Neill <bo...@alumni.brown.edu>wrote:
>
>> Yep, it worked like a charm.  (PreparedStatement avoided the hex
>> conversion)
>>
>> But now, I'm seeing a few extra bytes come back in the select….
>> (I'll keep digging, but maybe you have some insight?)
>>
>> I see this:
>>
>> ERROR [2013-04-11 13:05:03,461] com.skookle.dao.RepositoryDao:
>> repository.add() byte.length()=[259804]
>>
>> ERROR [2013-04-11 13:08:08,487] com.skookle.dao.RepositoryDao:
>> repository.get() [foo.jpeg] byte.length()=[259861]
>>
>> (Notice the length's don't match up)
>>
>> Using this code:
>>
>>     public void addContent(String key, byte[] data)
>>
>>             throws NoHostAvailableException {
>>
>>         LOG.error("repository.add() byte.length()=[" + data.length + "]"
>> );
>>
>>         String statement = "INSERT INTO " + KEYSPACE + "." + TABLE + "(key,
>> data) VALUES (?, ?)";
>>
>>         PreparedStatement ps = session.prepare(statement);
>>
>>         BoundStatement bs = ps.bind(key, ByteBuffer.wrap(data));
>>
>>         session.execute(bs);
>>
>>     }
>>
>>
>>     public byte[] getContent(String key) throws NoHostAvailableException
>> {
>>
>>         Query select = select("data").from(KEYSPACE, TABLE).where(eq(
>> "key", key));
>>
>>         ResultSet resultSet = session.execute(select);
>>
>>         byte[] data = resultSet.one().getBytes("data").array();
>>
>>         LOG.error("repository.get() [" + key + "] byte.length()=[" +
>> data.length + "]");
>>
>>         return data;
>>
>>     }
>>
>> ---
>>
>> Brian O'Neill
>>
>> Lead Architect, Software Development
>>
>> *Health Market Science*
>>
>> *The Science of Better Results*
>>
>> 2700 Horizon Drive • King of Prussia, PA • 19406****
>>
>> M: 215.588.6024 • @boneill42 <http://www.twitter.com/boneill42>  •
>>
>> healthmarketscience.com
>>
>>
>> This information transmitted in this email message is for the intended
>> recipient only and may contain confidential and/or privileged material. If
>> you received this email in error and are not the intended recipient, or the
>> person responsible to deliver it to the intended recipient, please contact
>> the sender at the email above and delete this email and any attachments and
>> destroy any copies thereof. Any review, retransmission, dissemination,
>> copying or other use of, or taking any action in reliance upon, this
>> information by persons or entities other than the intended recipient is
>> strictly prohibited.****
>>
>> ** **
>>
>>
>> From: Sylvain Lebresne <sy...@datastax.com>
>> Reply-To: <us...@cassandra.apache.org>
>> Date: Thursday, April 11, 2013 8:48 AM
>> To: "user@cassandra.apache.org" <us...@cassandra.apache.org>
>> Cc: Gabriel Ciuloaica <gc...@gmail.com>
>> Subject: Re: Blobs in CQL?
>>
>>
>> Hopefully, the prepared statement doesn't do the conversion.
>>>
>>
>> It does not.
>>
>>
>>> (I'm not sure if it is a limitation of the CQL protocol itself)
>>>
>>> thanks again,
>>> -brian
>>>
>>>
>>>
>>> ---
>>> Brian O'Neill
>>> Lead Architect, Software Development
>>> Health Market Science
>>> The Science of Better Results
>>> 2700 Horizon Drive • King of Prussia, PA • 19406
>>> M: 215.588.6024 • @boneill42 <http://www.twitter.com/boneill42>  •
>>> healthmarketscience.com
>>>
>>> This information transmitted in this email message is for the intended
>>> recipient only and may contain confidential and/or privileged material.
>>> If
>>> you received this email in error and are not the intended recipient, or
>>> the person responsible to deliver it to the intended recipient, please
>>> contact the sender at the email above and delete this email and any
>>> attachments and destroy any copies thereof. Any review, retransmission,
>>> dissemination, copying or other use of, or taking any action in reliance
>>> upon, this information by persons or entities other than the intended
>>> recipient is strictly prohibited.
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> On 4/11/13 8:34 AM, "Gabriel Ciuloaica" <gc...@gmail.com> wrote:
>>>
>>> >I'm not using the query builder but the PreparedStatement.
>>> >
>>> >Here is the sample code: https://gist.github.com/devsprint/5363023
>>> >
>>> >Gabi
>>> >On 4/11/13 3:27 PM, Brian O'Neill wrote:
>>> >> Great!
>>> >>
>>> >> Thanks Gabriel.  Do you have an example? (are using QueryBuilder?)
>>> >> I couldn't find the part of  the API that allowed you to pass in the
>>> >>byte
>>> >> array.
>>> >>
>>> >> -brian
>>> >>
>>> >> ---
>>> >> Brian O'Neill
>>> >> Lead Architect, Software Development
>>> >> Health Market Science
>>> >> The Science of Better Results
>>> >> 2700 Horizon Drive € King of Prussia, PA € 19406
>>> >> M: 215.588.6024 € @boneill42 <http://www.twitter.com/boneill42>  €
>>> >> healthmarketscience.com
>>> >>
>>> >> This information transmitted in this email message is for the intended
>>> >> recipient only and may contain confidential and/or privileged
>>> material.
>>> >>If
>>> >> you received this email in error and are not the intended recipient,
>>> or
>>> >> the person responsible to deliver it to the intended recipient, please
>>> >> contact the sender at the email above and delete this email and any
>>> >> attachments and destroy any copies thereof. Any review,
>>> retransmission,
>>> >> dissemination, copying or other use of, or taking any action in
>>> reliance
>>> >> upon, this information by persons or entities other than the intended
>>> >> recipient is strictly prohibited.
>>> >>
>>> >>
>>> >>
>>> >>
>>> >>
>>> >>
>>> >>
>>> >> On 4/11/13 8:25 AM, "Gabriel Ciuloaica" <gc...@gmail.com> wrote:
>>> >>
>>> >>> Hi Brian,
>>> >>>
>>> >>> I'm using the blobs to store images in cassandra(1.2.3) using the
>>> >>> java-driver version 1.0.0-beta1.
>>> >>> There is no need to convert a byte array into hex.
>>> >>>
>>> >>> Br,
>>> >>> Gabi
>>> >>>
>>> >>> On 4/11/13 3:21 PM, Brian O'Neill wrote:
>>> >>>> I started playing around with the CQL driver.
>>> >>>> Has anyone used blobs with it yet?
>>> >>>>
>>> >>>> Are you forced to convert a byte[] to hex?
>>> >>>> (e.g. I have a photo that I want to store in C* using the
>>> java-driver
>>> >>>> API)
>>> >>>>
>>> >>>> -brian
>>> >>>>
>>> >>>> --
>>> >>>> Brian ONeill
>>> >>>> Lead Architect, Health Market Science (
>>> http://healthmarketscience.com)
>>> >>>> mobile:215.588.6024
>>> >>>> blog: http://brianoneill.blogspot.com/
>>> >>>> twitter: @boneill42
>>> >>
>>> >
>>>
>>>
>>>
>>
>
>
> --
> Brian ONeill
> Lead Architect, Health Market Science (http://healthmarketscience.com)
>
> mobile:215.588.6024
> blog: http://brianoneill.blogspot.com/
> twitter: @boneill42
>

Re: Blobs in CQL?

Posted by Brian O'Neill <bo...@alumni.brown.edu>.
Sylvain,

Interesting, when I look at the actual bytes returned, I see the byte array
is prefixed with the keyspace and table name.

I assume I'm doing something wrong in the select.  Am I incorrectly using
the ResultSet?

-brian

On Thu, Apr 11, 2013 at 9:09 AM, Brian O'Neill <bo...@alumni.brown.edu>wrote:

> Yep, it worked like a charm.  (PreparedStatement avoided the hex
> conversion)
>
> But now, I'm seeing a few extra bytes come back in the select….
> (I'll keep digging, but maybe you have some insight?)
>
> I see this:
>
> ERROR [2013-04-11 13:05:03,461] com.skookle.dao.RepositoryDao:
> repository.add() byte.length()=[259804]
>
> ERROR [2013-04-11 13:08:08,487] com.skookle.dao.RepositoryDao:
> repository.get() [foo.jpeg] byte.length()=[259861]
>
> (Notice the length's don't match up)
>
> Using this code:
>
>     public void addContent(String key, byte[] data)
>
>             throws NoHostAvailableException {
>
>         LOG.error("repository.add() byte.length()=[" + data.length + "]");
>
>         String statement = "INSERT INTO " + KEYSPACE + "." + TABLE + "(key,
> data) VALUES (?, ?)";
>
>         PreparedStatement ps = session.prepare(statement);
>
>         BoundStatement bs = ps.bind(key, ByteBuffer.wrap(data));
>
>         session.execute(bs);
>
>     }
>
>
>     public byte[] getContent(String key) throws NoHostAvailableException {
>
>         Query select = select("data").from(KEYSPACE, TABLE).where(eq("key",
> key));
>
>         ResultSet resultSet = session.execute(select);
>
>         byte[] data = resultSet.one().getBytes("data").array();
>
>         LOG.error("repository.get() [" + key + "] byte.length()=[" + data.
> length + "]");
>
>         return data;
>
>     }
>
> ---
>
> Brian O'Neill
>
> Lead Architect, Software Development
>
> *Health Market Science*
>
> *The Science of Better Results*
>
> 2700 Horizon Drive • King of Prussia, PA • 19406****
>
> M: 215.588.6024 • @boneill42 <http://www.twitter.com/boneill42>  •
>
> healthmarketscience.com
>
>
> This information transmitted in this email message is for the intended
> recipient only and may contain confidential and/or privileged material. If
> you received this email in error and are not the intended recipient, or the
> person responsible to deliver it to the intended recipient, please contact
> the sender at the email above and delete this email and any attachments and
> destroy any copies thereof. Any review, retransmission, dissemination,
> copying or other use of, or taking any action in reliance upon, this
> information by persons or entities other than the intended recipient is
> strictly prohibited.****
>
> ** **
>
>
> From: Sylvain Lebresne <sy...@datastax.com>
> Reply-To: <us...@cassandra.apache.org>
> Date: Thursday, April 11, 2013 8:48 AM
> To: "user@cassandra.apache.org" <us...@cassandra.apache.org>
> Cc: Gabriel Ciuloaica <gc...@gmail.com>
> Subject: Re: Blobs in CQL?
>
>
> Hopefully, the prepared statement doesn't do the conversion.
>>
>
> It does not.
>
>
>> (I'm not sure if it is a limitation of the CQL protocol itself)
>>
>> thanks again,
>> -brian
>>
>>
>>
>> ---
>> Brian O'Neill
>> Lead Architect, Software Development
>> Health Market Science
>> The Science of Better Results
>> 2700 Horizon Drive • King of Prussia, PA • 19406
>> M: 215.588.6024 • @boneill42 <http://www.twitter.com/boneill42>  •
>> healthmarketscience.com
>>
>> This information transmitted in this email message is for the intended
>> recipient only and may contain confidential and/or privileged material. If
>> you received this email in error and are not the intended recipient, or
>> the person responsible to deliver it to the intended recipient, please
>> contact the sender at the email above and delete this email and any
>> attachments and destroy any copies thereof. Any review, retransmission,
>> dissemination, copying or other use of, or taking any action in reliance
>> upon, this information by persons or entities other than the intended
>> recipient is strictly prohibited.
>>
>>
>>
>>
>>
>>
>>
>> On 4/11/13 8:34 AM, "Gabriel Ciuloaica" <gc...@gmail.com> wrote:
>>
>> >I'm not using the query builder but the PreparedStatement.
>> >
>> >Here is the sample code: https://gist.github.com/devsprint/5363023
>> >
>> >Gabi
>> >On 4/11/13 3:27 PM, Brian O'Neill wrote:
>> >> Great!
>> >>
>> >> Thanks Gabriel.  Do you have an example? (are using QueryBuilder?)
>> >> I couldn't find the part of  the API that allowed you to pass in the
>> >>byte
>> >> array.
>> >>
>> >> -brian
>> >>
>> >> ---
>> >> Brian O'Neill
>> >> Lead Architect, Software Development
>> >> Health Market Science
>> >> The Science of Better Results
>> >> 2700 Horizon Drive € King of Prussia, PA € 19406
>> >> M: 215.588.6024 € @boneill42 <http://www.twitter.com/boneill42>  €
>> >> healthmarketscience.com
>> >>
>> >> This information transmitted in this email message is for the intended
>> >> recipient only and may contain confidential and/or privileged material.
>> >>If
>> >> you received this email in error and are not the intended recipient, or
>> >> the person responsible to deliver it to the intended recipient, please
>> >> contact the sender at the email above and delete this email and any
>> >> attachments and destroy any copies thereof. Any review, retransmission,
>> >> dissemination, copying or other use of, or taking any action in
>> reliance
>> >> upon, this information by persons or entities other than the intended
>> >> recipient is strictly prohibited.
>> >>
>> >>
>> >>
>> >>
>> >>
>> >>
>> >>
>> >> On 4/11/13 8:25 AM, "Gabriel Ciuloaica" <gc...@gmail.com> wrote:
>> >>
>> >>> Hi Brian,
>> >>>
>> >>> I'm using the blobs to store images in cassandra(1.2.3) using the
>> >>> java-driver version 1.0.0-beta1.
>> >>> There is no need to convert a byte array into hex.
>> >>>
>> >>> Br,
>> >>> Gabi
>> >>>
>> >>> On 4/11/13 3:21 PM, Brian O'Neill wrote:
>> >>>> I started playing around with the CQL driver.
>> >>>> Has anyone used blobs with it yet?
>> >>>>
>> >>>> Are you forced to convert a byte[] to hex?
>> >>>> (e.g. I have a photo that I want to store in C* using the java-driver
>> >>>> API)
>> >>>>
>> >>>> -brian
>> >>>>
>> >>>> --
>> >>>> Brian ONeill
>> >>>> Lead Architect, Health Market Science (
>> http://healthmarketscience.com)
>> >>>> mobile:215.588.6024
>> >>>> blog: http://brianoneill.blogspot.com/
>> >>>> twitter: @boneill42
>> >>
>> >
>>
>>
>>
>


-- 
Brian ONeill
Lead Architect, Health Market Science (http://healthmarketscience.com)

mobile:215.588.6024
blog: http://brianoneill.blogspot.com/
twitter: @boneill42

Re: Blobs in CQL?

Posted by Gabriel Ciuloaica <gc...@gmail.com>.
That's right, there is some padding there...
So, instead of getting calling array(), you have to do something like:

byte[] data = resultSet.one().getBytes("data");
int length = data.remaining();
blobBytes = new byte[length];
data.get(blobBytes, 0, length);


Gabi


On 4/11/13 4:09 PM, Brian O'Neill wrote:
> Yep, it worked like a charm.  (PreparedStatement avoided the hex 
> conversion)
>
> But now, I'm seeing a few extra bytes come back in the select….
> (I'll keep digging, but maybe you have some insight?)
>
> I see this:
>
> ERROR [2013-04-11 13:05:03,461] com.skookle.dao.RepositoryDao: 
> repository.add() byte.length()=[259804]
>
> ERROR [2013-04-11 13:08:08,487] com.skookle.dao.RepositoryDao: 
> repository.get() [foo.jpeg] byte.length()=[259861]
>
>
> (Notice the length's don't match up)
>
> Using this code:
>
> public void addContent(String key, byte[] data)
>
> throws NoHostAvailableException {
>
> LOG.error("repository.add() byte.length()=["+ data.length+ "]");
>
>   String statement = "INSERT INTO "+ KEYSPACE+ "."+ TABLE+ "(key, 
> data) VALUES (?, ?)";
>
>         PreparedStatement ps = session.prepare(statement);
>
>         BoundStatement bs = ps.bind(key, ByteBuffer.wrap(data));
>
> session.execute(bs);
>
>     }
>
>
> public byte[] getContent(String key) throws NoHostAvailableException {
>
>         Query select = select("data").from(KEYSPACE, 
> TABLE).where(eq("key", key));
>
>         ResultSet resultSet = session.execute(select);
>
> byte[] data = resultSet.one().getBytes("data").array();
>
> LOG.error("repository.get() ["+ key + "] byte.length()=["+ 
> data.length+ "]");
>
> return data;
>
>     }
>
>
> ---
>
> Brian O'Neill
>
> Lead Architect, Software Development
>
> *Health Market Science*
>
> /The Science of Better Results/
>
> 2700 Horizon Drive •King of Prussia, PA •19406
>
> M: 215.588.6024 • @boneill42 <http://www.twitter.com/boneill42> •
>
> healthmarketscience.com
>
>
> This information transmitted in this email message is for the intended 
> recipient only and may contain confidential and/or privileged 
> material. If you received this email in error and are not the intended 
> recipient, or the person responsible to deliver it to the intended 
> recipient, please contact the sender at the email above and delete 
> this email and any attachments and destroy any copies thereof. Any 
> review, retransmission, dissemination, copying or other use of, or 
> taking any action in reliance upon, this information by persons or 
> entities other than the intended recipient is strictly prohibited.
>
>
> From: Sylvain Lebresne <sylvain@datastax.com 
> <ma...@datastax.com>>
> Reply-To: <user@cassandra.apache.org <ma...@cassandra.apache.org>>
> Date: Thursday, April 11, 2013 8:48 AM
> To: "user@cassandra.apache.org <ma...@cassandra.apache.org>" 
> <user@cassandra.apache.org <ma...@cassandra.apache.org>>
> Cc: Gabriel Ciuloaica <gciuloaica@gmail.com <ma...@gmail.com>>
> Subject: Re: Blobs in CQL?
>
>
>     Hopefully, the prepared statement doesn't do the conversion.
>
>
> It does not.
>
>     (I'm not sure if it is a limitation of the CQL protocol itself)
>
>     thanks again,
>     -brian
>
>
>
>     ---
>     Brian O'Neill
>     Lead Architect, Software Development
>     Health Market Science
>     The Science of Better Results
>     2700 Horizon Drive • King of Prussia, PA • 19406
>     M: 215.588.6024 <tel:215.588.6024> • @boneill42
>     <http://www.twitter.com/boneill42>  •
>     healthmarketscience.com <http://healthmarketscience.com>
>
>     This information transmitted in this email message is for the intended
>     recipient only and may contain confidential and/or privileged
>     material. If
>     you received this email in error and are not the intended
>     recipient, or
>     the person responsible to deliver it to the intended recipient, please
>     contact the sender at the email above and delete this email and any
>     attachments and destroy any copies thereof. Any review,
>     retransmission,
>     dissemination, copying or other use of, or taking any action in
>     reliance
>     upon, this information by persons or entities other than the intended
>     recipient is strictly prohibited.
>
>
>
>
>
>
>
>     On 4/11/13 8:34 AM, "Gabriel Ciuloaica" <gciuloaica@gmail.com
>     <ma...@gmail.com>> wrote:
>
>     >I'm not using the query builder but the PreparedStatement.
>     >
>     >Here is the sample code: https://gist.github.com/devsprint/5363023
>     >
>     >Gabi
>     >On 4/11/13 3:27 PM, Brian O'Neill wrote:
>     >> Great!
>     >>
>     >> Thanks Gabriel.  Do you have an example? (are using QueryBuilder?)
>     >> I couldn't find the part of  the API that allowed you to pass
>     in the
>     >>byte
>     >> array.
>     >>
>     >> -brian
>     >>
>     >> ---
>     >> Brian O'Neill
>     >> Lead Architect, Software Development
>     >> Health Market Science
>     >> The Science of Better Results
>     >> 2700 Horizon Drive € King of Prussia, PA € 19406
>     >> M: 215.588.6024 <tel:215.588.6024> € @boneill42
>     <http://www.twitter.com/boneill42>  €
>     >> healthmarketscience.com <http://healthmarketscience.com>
>     >>
>     >> This information transmitted in this email message is for the
>     intended
>     >> recipient only and may contain confidential and/or privileged
>     material.
>     >>If
>     >> you received this email in error and are not the intended
>     recipient, or
>     >> the person responsible to deliver it to the intended recipient,
>     please
>     >> contact the sender at the email above and delete this email and any
>     >> attachments and destroy any copies thereof. Any review,
>     retransmission,
>     >> dissemination, copying or other use of, or taking any action in
>     reliance
>     >> upon, this information by persons or entities other than the
>     intended
>     >> recipient is strictly prohibited.
>     >>
>     >>
>     >>
>     >>
>     >>
>     >>
>     >>
>     >> On 4/11/13 8:25 AM, "Gabriel Ciuloaica" <gciuloaica@gmail.com
>     <ma...@gmail.com>> wrote:
>     >>
>     >>> Hi Brian,
>     >>>
>     >>> I'm using the blobs to store images in cassandra(1.2.3) using the
>     >>> java-driver version 1.0.0-beta1.
>     >>> There is no need to convert a byte array into hex.
>     >>>
>     >>> Br,
>     >>> Gabi
>     >>>
>     >>> On 4/11/13 3:21 PM, Brian O'Neill wrote:
>     >>>> I started playing around with the CQL driver.
>     >>>> Has anyone used blobs with it yet?
>     >>>>
>     >>>> Are you forced to convert a byte[] to hex?
>     >>>> (e.g. I have a photo that I want to store in C* using the
>     java-driver
>     >>>> API)
>     >>>>
>     >>>> -brian
>     >>>>
>     >>>> --
>     >>>> Brian ONeill
>     >>>> Lead Architect, Health Market Science
>     (http://healthmarketscience.com)
>     >>>> mobile:215.588.6024 <tel:215.588.6024>
>     >>>> blog: http://brianoneill.blogspot.com/
>     >>>> twitter: @boneill42
>     >>
>     >
>
>
>


Re: Blobs in CQL?

Posted by Brian O'Neill <bo...@alumni.brown.edu>.
Yep, it worked like a charm.  (PreparedStatement avoided the hex conversion)

But now, I'm seeing a few extra bytes come back in the select….
(I'll keep digging, but maybe you have some insight?)

I see this:
ERROR [2013-04-11 13:05:03,461] com.skookle.dao.RepositoryDao:
repository.add() byte.length()=[259804]

ERROR [2013-04-11 13:08:08,487] com.skookle.dao.RepositoryDao:
repository.get() [foo.jpeg] byte.length()=[259861]


(Notice the length's don't match up)

Using this code:
    public void addContent(String key, byte[] data)

            throws NoHostAvailableException {

        LOG.error("repository.add() byte.length()=[" + data.length + "]");

        String statement = "INSERT INTO " + KEYSPACE + "." + TABLE + "(key,
data) VALUES (?, ?)";

        PreparedStatement ps = session.prepare(statement);

        BoundStatement bs = ps.bind(key, ByteBuffer.wrap(data));

        session.execute(bs);

    }



    public byte[] getContent(String key) throws NoHostAvailableException {

        Query select = select("data").from(KEYSPACE, TABLE).where(eq("key",
key));

        ResultSet resultSet = session.execute(select);

        byte[] data = resultSet.one().getBytes("data").array();

        LOG.error("repository.get() [" + key + "] byte.length()=[" +
data.length + "]");

        return data;

    }


---
Brian O'Neill
Lead Architect, Software Development
Health Market Science
The Science of Better Results
2700 Horizon Drive • King of Prussia, PA • 19406
M: 215.588.6024 • @boneill42 <http://www.twitter.com/boneill42>   •
healthmarketscience.com


This information transmitted in this email message is for the intended
recipient only and may contain confidential and/or privileged material. If
you received this email in error and are not the intended recipient, or the
person responsible to deliver it to the intended recipient, please contact
the sender at the email above and delete this email and any attachments and
destroy any copies thereof. Any review, retransmission, dissemination,
copying or other use of, or taking any action in reliance upon, this
information by persons or entities other than the intended recipient is
strictly prohibited.
 


From:  Sylvain Lebresne <sy...@datastax.com>
Reply-To:  <us...@cassandra.apache.org>
Date:  Thursday, April 11, 2013 8:48 AM
To:  "user@cassandra.apache.org" <us...@cassandra.apache.org>
Cc:  Gabriel Ciuloaica <gc...@gmail.com>
Subject:  Re: Blobs in CQL?


> Hopefully, the prepared statement doesn't do the conversion.

It does not.
 
> (I'm not sure if it is a limitation of the CQL protocol itself)
> 
> thanks again,
> -brian
> 
> 
> 
> ---
> Brian O'Neill
> Lead Architect, Software Development
> Health Market Science
> The Science of Better Results
> 2700 Horizon Drive • King of Prussia, PA • 19406
> M: 215.588.6024 <tel:215.588.6024>  • @boneill42
> <http://www.twitter.com/boneill42>  •
> healthmarketscience.com <http://healthmarketscience.com>
> 
> This information transmitted in this email message is for the intended
> recipient only and may contain confidential and/or privileged material. If
> you received this email in error and are not the intended recipient, or
> the person responsible to deliver it to the intended recipient, please
> contact the sender at the email above and delete this email and any
> attachments and destroy any copies thereof. Any review, retransmission,
> dissemination, copying or other use of, or taking any action in reliance
> upon, this information by persons or entities other than the intended
> recipient is strictly prohibited.
> 
> 
> 
> 
> 
> 
> 
> On 4/11/13 8:34 AM, "Gabriel Ciuloaica" <gc...@gmail.com> wrote:
> 
>> >I'm not using the query builder but the PreparedStatement.
>> >
>> >Here is the sample code: https://gist.github.com/devsprint/5363023
>> >
>> >Gabi
>> >On 4/11/13 3:27 PM, Brian O'Neill wrote:
>>> >> Great!
>>> >>
>>> >> Thanks Gabriel.  Do you have an example? (are using QueryBuilder?)
>>> >> I couldn't find the part of  the API that allowed you to pass in the
>>> >>byte
>>> >> array.
>>> >>
>>> >> -brian
>>> >>
>>> >> ---
>>> >> Brian O'Neill
>>> >> Lead Architect, Software Development
>>> >> Health Market Science
>>> >> The Science of Better Results
>>> >> 2700 Horizon Drive € King of Prussia, PA € 19406
>>> >> M: 215.588.6024 <tel:215.588.6024>  € @boneill42
>>> <http://www.twitter.com/boneill42>  €
>>> >> healthmarketscience.com <http://healthmarketscience.com>
>>> >>
>>> >> This information transmitted in this email message is for the intended
>>> >> recipient only and may contain confidential and/or privileged material.
>>> >>If
>>> >> you received this email in error and are not the intended recipient, or
>>> >> the person responsible to deliver it to the intended recipient, please
>>> >> contact the sender at the email above and delete this email and any
>>> >> attachments and destroy any copies thereof. Any review, retransmission,
>>> >> dissemination, copying or other use of, or taking any action in reliance
>>> >> upon, this information by persons or entities other than the intended
>>> >> recipient is strictly prohibited.
>>> >>
>>> >>
>>> >>
>>> >>
>>> >>
>>> >>
>>> >>
>>> >> On 4/11/13 8:25 AM, "Gabriel Ciuloaica" <gc...@gmail.com> wrote:
>>> >>
>>>> >>> Hi Brian,
>>>> >>>
>>>> >>> I'm using the blobs to store images in cassandra(1.2.3) using the
>>>> >>> java-driver version 1.0.0-beta1.
>>>> >>> There is no need to convert a byte array into hex.
>>>> >>>
>>>> >>> Br,
>>>> >>> Gabi
>>>> >>>
>>>> >>> On 4/11/13 3:21 PM, Brian O'Neill wrote:
>>>>> >>>> I started playing around with the CQL driver.
>>>>> >>>> Has anyone used blobs with it yet?
>>>>> >>>>
>>>>> >>>> Are you forced to convert a byte[] to hex?
>>>>> >>>> (e.g. I have a photo that I want to store in C* using the java-driver
>>>>> >>>> API)
>>>>> >>>>
>>>>> >>>> -brian
>>>>> >>>>
>>>>> >>>> --
>>>>> >>>> Brian ONeill
>>>>> >>>> Lead Architect, Health Market Science
>>>>> (http://healthmarketscience.com)
>>>>> >>>> mobile:215.588.6024 <tel:215.588.6024>
>>>>> >>>> blog: http://brianoneill.blogspot.com/
>>>>> >>>> twitter: @boneill42
>>> >>
>> >
> 
> 




Re: Blobs in CQL?

Posted by Sylvain Lebresne <sy...@datastax.com>.
> Hopefully, the prepared statement doesn't do the conversion.
>

It does not.


> (I'm not sure if it is a limitation of the CQL protocol itself)
>
> thanks again,
> -brian
>
>
>
> ---
> Brian O'Neill
> Lead Architect, Software Development
> Health Market Science
> The Science of Better Results
> 2700 Horizon Drive • King of Prussia, PA • 19406
> M: 215.588.6024 • @boneill42 <http://www.twitter.com/boneill42>  •
> healthmarketscience.com
>
> This information transmitted in this email message is for the intended
> recipient only and may contain confidential and/or privileged material. If
> you received this email in error and are not the intended recipient, or
> the person responsible to deliver it to the intended recipient, please
> contact the sender at the email above and delete this email and any
> attachments and destroy any copies thereof. Any review, retransmission,
> dissemination, copying or other use of, or taking any action in reliance
> upon, this information by persons or entities other than the intended
> recipient is strictly prohibited.
>
>
>
>
>
>
>
> On 4/11/13 8:34 AM, "Gabriel Ciuloaica" <gc...@gmail.com> wrote:
>
> >I'm not using the query builder but the PreparedStatement.
> >
> >Here is the sample code: https://gist.github.com/devsprint/5363023
> >
> >Gabi
> >On 4/11/13 3:27 PM, Brian O'Neill wrote:
> >> Great!
> >>
> >> Thanks Gabriel.  Do you have an example? (are using QueryBuilder?)
> >> I couldn't find the part of  the API that allowed you to pass in the
> >>byte
> >> array.
> >>
> >> -brian
> >>
> >> ---
> >> Brian O'Neill
> >> Lead Architect, Software Development
> >> Health Market Science
> >> The Science of Better Results
> >> 2700 Horizon Drive € King of Prussia, PA € 19406
> >> M: 215.588.6024 € @boneill42 <http://www.twitter.com/boneill42>  €
> >> healthmarketscience.com
> >>
> >> This information transmitted in this email message is for the intended
> >> recipient only and may contain confidential and/or privileged material.
> >>If
> >> you received this email in error and are not the intended recipient, or
> >> the person responsible to deliver it to the intended recipient, please
> >> contact the sender at the email above and delete this email and any
> >> attachments and destroy any copies thereof. Any review, retransmission,
> >> dissemination, copying or other use of, or taking any action in reliance
> >> upon, this information by persons or entities other than the intended
> >> recipient is strictly prohibited.
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >> On 4/11/13 8:25 AM, "Gabriel Ciuloaica" <gc...@gmail.com> wrote:
> >>
> >>> Hi Brian,
> >>>
> >>> I'm using the blobs to store images in cassandra(1.2.3) using the
> >>> java-driver version 1.0.0-beta1.
> >>> There is no need to convert a byte array into hex.
> >>>
> >>> Br,
> >>> Gabi
> >>>
> >>> On 4/11/13 3:21 PM, Brian O'Neill wrote:
> >>>> I started playing around with the CQL driver.
> >>>> Has anyone used blobs with it yet?
> >>>>
> >>>> Are you forced to convert a byte[] to hex?
> >>>> (e.g. I have a photo that I want to store in C* using the java-driver
> >>>> API)
> >>>>
> >>>> -brian
> >>>>
> >>>> --
> >>>> Brian ONeill
> >>>> Lead Architect, Health Market Science (http://healthmarketscience.com
> )
> >>>> mobile:215.588.6024
> >>>> blog: http://brianoneill.blogspot.com/
> >>>> twitter: @boneill42
> >>
> >
>
>
>

Re: Blobs in CQL?

Posted by Brian O'Neill <bo...@alumni.brown.edu>.
Cool.  That might be it.  I'll take a look at PreparedStatement.

For query building, I took a look under the covers, and even when I was
passing in a ByteBuffer, it runs through the following code in the
java-driver:

Utils.java:
   if (value instanceof ByteBuffer) {
      sb.append("0x");
      sb.append(ByteBufferUtil.bytesToHex((ByteBuffer)value));
   }

Hopefully, the prepared statement doesn't do the conversion.
(I'm not sure if it is a limitation of the CQL protocol itself)

thanks again,
-brian



---
Brian O'Neill
Lead Architect, Software Development
Health Market Science
The Science of Better Results
2700 Horizon Drive • King of Prussia, PA • 19406
M: 215.588.6024 • @boneill42 <http://www.twitter.com/boneill42>  •
healthmarketscience.com

This information transmitted in this email message is for the intended
recipient only and may contain confidential and/or privileged material. If
you received this email in error and are not the intended recipient, or
the person responsible to deliver it to the intended recipient, please
contact the sender at the email above and delete this email and any
attachments and destroy any copies thereof. Any review, retransmission,
dissemination, copying or other use of, or taking any action in reliance
upon, this information by persons or entities other than the intended
recipient is strictly prohibited.
 






On 4/11/13 8:34 AM, "Gabriel Ciuloaica" <gc...@gmail.com> wrote:

>I'm not using the query builder but the PreparedStatement.
>
>Here is the sample code: https://gist.github.com/devsprint/5363023
>
>Gabi
>On 4/11/13 3:27 PM, Brian O'Neill wrote:
>> Great!
>>
>> Thanks Gabriel.  Do you have an example? (are using QueryBuilder?)
>> I couldn't find the part of  the API that allowed you to pass in the
>>byte
>> array.
>>
>> -brian
>>
>> ---
>> Brian O'Neill
>> Lead Architect, Software Development
>> Health Market Science
>> The Science of Better Results
>> 2700 Horizon Drive € King of Prussia, PA € 19406
>> M: 215.588.6024 € @boneill42 <http://www.twitter.com/boneill42>  €
>> healthmarketscience.com
>>
>> This information transmitted in this email message is for the intended
>> recipient only and may contain confidential and/or privileged material.
>>If
>> you received this email in error and are not the intended recipient, or
>> the person responsible to deliver it to the intended recipient, please
>> contact the sender at the email above and delete this email and any
>> attachments and destroy any copies thereof. Any review, retransmission,
>> dissemination, copying or other use of, or taking any action in reliance
>> upon, this information by persons or entities other than the intended
>> recipient is strictly prohibited.
>>   
>>
>>
>>
>>
>>
>>
>> On 4/11/13 8:25 AM, "Gabriel Ciuloaica" <gc...@gmail.com> wrote:
>>
>>> Hi Brian,
>>>
>>> I'm using the blobs to store images in cassandra(1.2.3) using the
>>> java-driver version 1.0.0-beta1.
>>> There is no need to convert a byte array into hex.
>>>
>>> Br,
>>> Gabi
>>>
>>> On 4/11/13 3:21 PM, Brian O'Neill wrote:
>>>> I started playing around with the CQL driver.
>>>> Has anyone used blobs with it yet?
>>>>
>>>> Are you forced to convert a byte[] to hex?
>>>> (e.g. I have a photo that I want to store in C* using the java-driver
>>>> API)
>>>>
>>>> -brian
>>>>
>>>> -- 
>>>> Brian ONeill
>>>> Lead Architect, Health Market Science (http://healthmarketscience.com)
>>>> mobile:215.588.6024
>>>> blog: http://brianoneill.blogspot.com/
>>>> twitter: @boneill42
>>
>



Re: Blobs in CQL?

Posted by Gabriel Ciuloaica <gc...@gmail.com>.
I'm not using the query builder but the PreparedStatement.

Here is the sample code: https://gist.github.com/devsprint/5363023

Gabi
On 4/11/13 3:27 PM, Brian O'Neill wrote:
> Great!
>
> Thanks Gabriel.  Do you have an example? (are using QueryBuilder?)
> I couldn't find the part of  the API that allowed you to pass in the byte
> array.
>
> -brian
>
> ---
> Brian O'Neill
> Lead Architect, Software Development
> Health Market Science
> The Science of Better Results
> 2700 Horizon Drive € King of Prussia, PA € 19406
> M: 215.588.6024 € @boneill42 <http://www.twitter.com/boneill42>  €
> healthmarketscience.com
>
> This information transmitted in this email message is for the intended
> recipient only and may contain confidential and/or privileged material. If
> you received this email in error and are not the intended recipient, or
> the person responsible to deliver it to the intended recipient, please
> contact the sender at the email above and delete this email and any
> attachments and destroy any copies thereof. Any review, retransmission,
> dissemination, copying or other use of, or taking any action in reliance
> upon, this information by persons or entities other than the intended
> recipient is strictly prohibited.
>   
>
>
>
>
>
>
> On 4/11/13 8:25 AM, "Gabriel Ciuloaica" <gc...@gmail.com> wrote:
>
>> Hi Brian,
>>
>> I'm using the blobs to store images in cassandra(1.2.3) using the
>> java-driver version 1.0.0-beta1.
>> There is no need to convert a byte array into hex.
>>
>> Br,
>> Gabi
>>
>> On 4/11/13 3:21 PM, Brian O'Neill wrote:
>>> I started playing around with the CQL driver.
>>> Has anyone used blobs with it yet?
>>>
>>> Are you forced to convert a byte[] to hex?
>>> (e.g. I have a photo that I want to store in C* using the java-driver
>>> API)
>>>
>>> -brian
>>>
>>> -- 
>>> Brian ONeill
>>> Lead Architect, Health Market Science (http://healthmarketscience.com)
>>> mobile:215.588.6024
>>> blog: http://brianoneill.blogspot.com/
>>> twitter: @boneill42
>


Re: Blobs in CQL?

Posted by Brian O'Neill <bo...@alumni.brown.edu>.
Great!

Thanks Gabriel.  Do you have an example? (are using QueryBuilder?)
I couldn't find the part of  the API that allowed you to pass in the byte
array.

-brian

---
Brian O'Neill
Lead Architect, Software Development
Health Market Science
The Science of Better Results
2700 Horizon Drive € King of Prussia, PA € 19406
M: 215.588.6024 € @boneill42 <http://www.twitter.com/boneill42>  €
healthmarketscience.com

This information transmitted in this email message is for the intended
recipient only and may contain confidential and/or privileged material. If
you received this email in error and are not the intended recipient, or
the person responsible to deliver it to the intended recipient, please
contact the sender at the email above and delete this email and any
attachments and destroy any copies thereof. Any review, retransmission,
dissemination, copying or other use of, or taking any action in reliance
upon, this information by persons or entities other than the intended
recipient is strictly prohibited.
 






On 4/11/13 8:25 AM, "Gabriel Ciuloaica" <gc...@gmail.com> wrote:

>Hi Brian,
>
>I'm using the blobs to store images in cassandra(1.2.3) using the
>java-driver version 1.0.0-beta1.
>There is no need to convert a byte array into hex.
>
>Br,
>Gabi
>
>On 4/11/13 3:21 PM, Brian O'Neill wrote:
>>
>> I started playing around with the CQL driver.
>> Has anyone used blobs with it yet?
>>
>> Are you forced to convert a byte[] to hex?
>> (e.g. I have a photo that I want to store in C* using the java-driver
>>API)
>>
>> -brian
>>
>> -- 
>> Brian ONeill
>> Lead Architect, Health Market Science (http://healthmarketscience.com)
>> mobile:215.588.6024
>> blog: http://brianoneill.blogspot.com/
>> twitter: @boneill42
>



Re: Blobs in CQL?

Posted by Gabriel Ciuloaica <gc...@gmail.com>.
Hi Brian,

I'm using the blobs to store images in cassandra(1.2.3) using the 
java-driver version 1.0.0-beta1.
There is no need to convert a byte array into hex.

Br,
Gabi

On 4/11/13 3:21 PM, Brian O'Neill wrote:
>
> I started playing around with the CQL driver.
> Has anyone used blobs with it yet?
>
> Are you forced to convert a byte[] to hex?
> (e.g. I have a photo that I want to store in C* using the java-driver API)
>
> -brian
>
> -- 
> Brian ONeill
> Lead Architect, Health Market Science (http://healthmarketscience.com)
> mobile:215.588.6024
> blog: http://brianoneill.blogspot.com/
> twitter: @boneill42