Hello Adrian,


Calliope relies on transformers to convert from a given type to ByteBuffer
which is the format that is required by Cassandra.

RichByteBuffer's incompleteness is at fault here. We are working on
increasing the types we support out of the box, and will support all types
supported in C* in the next release.

In the meanwhile all that is needed is to add implicit transformers for
your type. In this case A transformer from Boolean -> ByteBuffer is missing.
Cassandra stores boolean as a Byte, So you will need to add these 2 lines
to your code -

  implicit def ByteBuffer2Boolean(buffer: ByteBuffer): Boolean =
buffer.get() == 1


  implicit def Boolean2ByteBuffer(bool: Boolean): ByteBuffer =
ByteBuffer.wrap(if(bool) Array(1.toByte) else Array(0.toByte))

Cheers,
Rohit


*Founder & CEO, **Tuplejump, Inc.*
____________________________
www.tuplejump.com
*The Data Engineering Platform*


On Fri, Apr 18, 2014 at 1:41 AM, Adrian Mocanu <amoc...@verticalscope.com>wrote:

>  Has anyone managed to write Booleans to Cassandra from an RDD with
> Calliope?
>
> My Booleans give compile time errors: expression of type List[Any] does
> not conform to expected type Types.CQLRowValues
>
> CQLColumnValue is definted as ByteBuffer: type CQLColumnValue = ByteBuffer
>
>
>
> For now I convert them to string. I tried converting them to bytes but
> that compiled but gave me a runtime error since scala byte is not
> compatible with Cassandra Boolean.
>
>
>
> -Adrian
>
>
>

Reply via email to