spotify/hdfs2cass — pull request #7 by mattnworb (2014-12-16 11:35:07+00:00)
Title: add CQL collection support

This change adds support for CQL collections (Sets, Lists, Maps) for
jobs that return CQLRecords.

The support is implemented by re-using the TypeSerializer
implementations from within Cassandra itself.

In order to serialize a collection, the serializer for the element type
needs to be known as well - it is a bit hacky but the current solution
involves peeking at the first element in the collection to get it's
runtime type, and retrieving a TypeSerializer from a Map within
CassandraRecordUtils.

In implementing this I noticed that the serialization of Collections has
changed between V2 and V3 of the CQL protocol. V3 is only supported by
Cassandra v2.1 so far, while V2 is understood by v2.0 (Cassandra v2.1
should support protocol V2 also).

Since this implementation reuses the TypeSerializers from within
cassandra-all:2.0.11:jar, it is implicitly using V2 of the protocol
format. This should be fine as long as the target Cassandra server is
using v2.0. I have not tested using these serializers when exporting to
Cassandra v1.x or v2.1+.