You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Clint Kelly <cl...@gmail.com> on 2015/02/23 14:33:24 UTC

Any notion of "unions" in C* user-defined types?

Hi all,

I am building an application that keeps a time-series record of clickstream
data (clicks, impressions, etc.).  The data model looks something like:

CREATE TABLE clickstream (
  userid text,
  event_time timestamp,
  interaction frozen <interaction_type>,
  PRIMARY KEY (userid, timestamp)
) WITH CLUSTERING ORDER BY (event_time DESC);

I would like to create a user-defined type "interaction_type" such that it
can be different depending on whether the interaction was a click, view,
etc.

Previously we encoded such data with Avro, using Avro's "unions" (
http://avro.apache.org/docs/1.7.5/idl.html#unions) and encoded the data as
blobs.  I was hoping to get away from blobs now that we have UDTs in
Cassandra 2.1, but I don't see any support for unions.

Does anyone have any suggestions?  I think I may be better of just sticking
with Avro serialization.  :(

Best regards,
Clint