You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by varun allampalli <vs...@gmail.com> on 2014/01/24 11:12:54 UTC

sorting with sstableloader

Hi,

I have a table with schema

CREATE TABLE TEST_TABLE (

  keyCol bigint,

  col1 bigint,

  col2 bigint,

  col3 text,

 ) WITH CLUSTERING ORDER BY (col1 DESC, col2 DESC)

on cassandra 1.2.13


I used SSTableSimpleUnsortedWriter and sstableloader to load some data and
loaded data for a keycolumn keyCol1

select * from test_table returned

 keyCol         col1     col2        col3

keyCol1        10        1          abcde

keyCol1         9         1          adfsa


I again created some sstables and loaded using sstableloader which has
records for keyCol1, but with col1 value as 20 which is

keyCol         col1     col2        col3

keyCol1        20         1           afd

So when I queried select * from test_table I was expecting

keyCol1        20         1           afd
keyCol1        10        1          abcde

keyCol1         9         1          adfsa


but it returned
keyCol1        10        1          abcde

keyCol1         9         1          adfsa

keyCol1        20         1           afd
How to fix this sorting, the col1 of value 20 was inserted later using
sstableloader so it is showing up as the last row.

Is there anyway to rewrite sstables to fix this sorting, or do I need to
run anything after running sstable loader to fix this sorting.

Thanks
Varun