scala - column Name of LongType instead of Utf8Type in cassandra cli column family -


i new @ cassandra cli, want know is practice define columns name longtype instead of utf8type , please tell me there wrong in code or coding style?
i doing in scala in playframework hector.

val mutator = hfactory.createmutator(group, le); mutator.addinsertion(groupid,"grouprefrence",hfactory.createcolumn(userid,userid,le,le)) mutator.execute() 

def getmembersrefrence(groupid: long) = { val slicequery = hfactory.createslicequery(group, le, le, le) slicequery.setcolumnfamily("grouprefrence") slicequery.setkey(groupid) slicequery.setrange(long.min_value,long.max_value, false, integer.max_value) val result = slicequery.execute() val res = result.get() val columns = res.getcolumns() val response = columns.tolist response } 

good practice define columns name longtype instead of utf8type

you should define column name datatype whatever makes sense data model. far best practices go, ebay posted tech blog on couple of years ago, , read. part 2 covers column names:

storing values in column names ok

leaving column values empty (“valueless” columns) ok.

it’s common practice cassandra store value (actual data) in column name (a.k.a. column key), , leave column value field empty if there nothing else store. 1 motivation practice column names stored physically sorted, column values not.

notes:

  • the maximum column key (and row key) size 64kb. however, don’t store ‘item description’ column key!

  • don’t use timestamp alone column key. might colliding timestamps 2 or more app servers writing cassandra. prefer timeuuid (type-1 uuid) instead.

  • the maximum column value size 2 gb. becuase there no streaming , whole value fetched in heap memory when requested, limit size few mbs. (large objects not supported in near future – cassandra-265. however, astyanax client library supports large objects chunking them.)

i feel compelled mention newer versions of cassandra moving away original column family , cli interaction. i'm not sure if newer cql3 drivers support storing values in column names or not (i've had in via thrift hector, not cql3). in case, here article (a thrift cql3 upgrade guide) describes these differences, , should read through future endeavors.


Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -