Hi David,

We have adapted Bulkload example provided by Datastax as below to write 
SSTables for column family that uses Composite keys and this is working fine 
for us. Hope this will be of use to you.



       List<AbstractType<?>> compositeList = new ArrayList<AbstractType<?>>();

        compositeList.add(UTF8Type.instance);

        compositeList.add(UTF8Type.instance);

        compositeList.add(UTF8Type.instance);






        SSTableSimpleUnsortedWriter usersWriter = new

SSTableSimpleUnsortedWriter(

                directory,

                new Murmur3Partitioner(),

                keyspace,

                columnFamily,

                CompositeType.getInstance(compositeList),

                null,

                64);


        String line;

        int lineNumber = 1;

        CsvEntry entry = new CsvEntry();

        long timestamp = System.currentTimeMillis() * 1000;

        while ((line = reader.readLine()) != null)

        {

            if (entry.parse(line, lineNumber))

            {

                CompositeType.Builder builder = new 
CompositeType.Builder(CompositeType.getInstance(compositeList) );

                usersWriter.newRow(bytes(entry.Key));

                builder.add(bytes(entry.column1));

                builder.add(bytes(entry.column2));

                builder.add(bytes(entry.column3));

                usersWriter.addColumn(builder.build(), 
(bytes(entry.column4)),timestamp);

             }

            lineNumber++;

        }





Regards,

Praveen

Wipro Limited (Company Regn No in UK FC 019088)
Address: Level 2, West wing, 3 Sheldon Square, London W2 6PS, United Kingdom. 
Tel +44 20 7432 8500 Fax: +44 20 7286 5703 

VAT Number: 563 1964 27

(Branch of Wipro Limited (Incorporated in India at Bangalore with limited 
liability vide Reg no L99999KA1945PLC02800 with Registrar of Companies at 
Bangalore, India. Authorized share capital  Rs 5550 mn))

Please do not print this email unless it is absolutely necessary. 

The information contained in this electronic message and any attachments to 
this message are intended for the exclusive use of the addressee(s) and may 
contain proprietary, confidential or privileged information. If you are not the 
intended recipient, you should not disseminate, distribute or copy this e-mail. 
Please notify the sender immediately and destroy all copies of this message and 
any attachments. 

WARNING: Computer viruses can be transmitted via email. The recipient should 
check this email and any attachments for the presence of viruses. The company 
accepts no liability for any damage caused by any virus transmitted by this 
email. 

www.wipro.com

Reply via email to