Hi All.  I am trying to bulk load some data into a CQL3 table using the sstableloader utility and I am having some difficulty figuring out how to use the SSTableSimpleUnsortedWriter with composite columns.

I have created this simple contrived table for testing:

create table test (key varchar, val1 int, val2 int, primary key (key, val1, val2));

Loosely following the bulk loading example in the docs, I have constructed the following method to create my temporary SSTables.

public static void main(String[] args) throws Exception {
   final List<AbstractType<?>> compositeTypes = new ArrayList<>();
   compositeTypes.add(UTF8Type.instance);
   compositeTypes.add(IntegerType.instance);
   compositeTypes.add(IntegerType.instance);
   final CompositeType compType = 
      CompositeType.getInstance(compositeTypes);
   SSTableSimpleUnsortedWriter ssTableWriter = 
      new SSTableSimpleUnsortedWriter(
         new File("/tmp/cassandra_bulk/bigdata/test"), 
         new Murmur3Partitioner() , 
         "bigdata", 
         "test", 
         compType, 
         null, 
         128);

   final Builder builder = 
      new CompositeType.Builder(compType);

   builder.add(bytes("20101201"));
   builder.add(bytes(5));
   builder.add(bytes(10));

   ssTableWriter.newRow(bytes("20101201"));
   ssTableWriter.addColumn(
         builder.build(), 
         ByteBuffer.allocate(0), 
         System.currentTimeMillis()
   );
   
   ssTableWriter.close();
}

When I execute this method and load the data using sstableloader, if I do a 'SELECT * FROM test' in cqlsh, I get the results:

key      | val1       | val2
----------------------------
20101201 | '20101201' | 5

And the error:  Failed to decode value '20101201' (for column 'val1') as int.

The error I get makes sense, as apparently it tried to place the key value into the val1 column.  From this error, I then assumed that the key value should not be part of the composite type when the row is added, so I removed the UTF8Type from the composite type, and only added the two integer values through the builder, but when I repeat the select with that data loaded, Cassandra throws an ArrayIndexOutOfBoundsException in the ColumnGroupMap class.

Can anyone offer any advice on the correct way to insert data via the bulk loading process into CQL3 tables with composite columns?  Does the fact that I am not inserting a value for the columns make a difference?  For my particular use case, all I care about is the values in the column names themselves (and the associated sorting that goes with them).

Any info or help anyone could provide would be very much appreciated.

Regards,

Daniel Morton