Re: Can I call getBytes on a text column to get the raw (already encoded UTF8)

2014-06-24 Thread Olivier Michallat
Assuming we're talking about the DataStax Java driver: getBytes will throw an exception, because it validates that the column is of type BLOB. But you can use getBytesUnsafe: ByteBuffer b = row.getBytesUnsafe(aTextColumn); // if you want to check it: Charset.forName(UTF-8).decode(b);

Re: Can I call getBytes on a text column to get the raw (already encoded UTF8)

2014-06-24 Thread Robert Stupp
You can use getBytesUnsafe on the UTF8 column -- Sent from my iPhone Am 24.06.2014 um 09:13 schrieb Olivier Michallat olivier.michal...@datastax.com: Assuming we're talking about the DataStax Java driver: getBytes will throw an exception, because it validates that the column is of

Re: Can I call getBytes on a text column to get the raw (already encoded UTF8)

2014-06-24 Thread Kevin Burton
Yes… I confirmed that getBytesUnsafe works… I also have a unit test for it so if cassandra ever changes anything we'll pick it up. One point in your above code. I still think charsets are behind a synchronized code block. So your above code wouldn't be super fast on multi-core machines. I

Can I call getBytes on a text column to get the raw (already encoded UTF8)

2014-06-23 Thread Kevin Burton
I'm building a webservice whereby I read the data from cassandra, then write it over the wire. It's going to push LOTS of content, and encoding/decoding performance has really bitten us in the future. So I try to avoid transparent encoding/decoding if I can avoid it. So right now, I have a huge

Re: Can I call getBytes on a text column to get the raw (already encoded UTF8)

2014-06-23 Thread DuyHai Doan
Good idea, bytes are merely processed by the server so you're saving a lot of Cpu. AFAIK getBytes should work fine. Le 24 juin 2014 05:50, Kevin Burton bur...@spinn3r.com a écrit : I'm building a webservice whereby I read the data from cassandra, then write it over the wire. It's going to