incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Raihan Jamal <jamalrai...@gmail.com>
Subject Storing binary blobs data in Cassandra Column family?
Date Thu, 19 Sep 2013 20:24:11 GMT
I need to store binary byte data in Cassandra column family in all my
columns. Each columns will have its own binary byte data. Below is the code
where I will be getting binary byte data. My rowKey is going to be String
but all my columns has to store binary blobs data.

    GenericDatumWriter<GenericRecord> writer = new
GenericDatumWriter<GenericRecord>(schema);
    ByteArrayOutputStream os = new ByteArrayOutputStream();
    Encoder e = EncoderFactory.get().binaryEncoder(os, null);
    writer.write(record, e);
    e.flush();
    byte[] byteData = os.toByteArray();
    os.close();
  // write byteData in Cassandra for the columns


I am not sure what should be the right way to create the Cassandra column
family for the above use case? Below is the column family, I have created
but I am not sure this is the right way to do that for above use case?

    create column family TESTING
    with key_validation_class = 'UTF8Type'
    and comparator = 'BytesType'
    and default_validation_class = 'UTF8Type'
    and gc_grace = 86400
    and column_metadata = [ {column_name : 'lmd', validation_class :
DateType}];




*Raihan Jamal*

Mime
View raw message