tolbertam / sstable-tools

Tools for parsing, creating and doing other fun stuff with sstables
Apache License 2.0
162 stars 31 forks source link

'limit' seems to not consider query criteria #36

Closed tolbertam closed 8 years ago

tolbertam commented 8 years ago

It looks like the limit support does not consider query criteria, i.e.:

cqlsh> select * from sstable where ticker='YHOO' limit 5;
 ┌─────────┬─────────────────────┬────────────┬─────────┬─────────┬─────────┬─────────┬─────────┐
 │ticker   │date                 │adj_close   │close    │high     │low      │open     │volume   │
 ╞═════════╪═════════════════════╪════════════╪═════════╪═════════╪═════════╪═════════╪═════════╡
 │ORCL     │2016-02-19 00:00-0600│36.779999   │36.779999│36.790001│36.419998│36.52    │13118400 │
 ├─────────┼─────────────────────┼────────────┼─────────┼─────────┼─────────┼─────────┼─────────┤
 │ORCL     │2016-02-18 00:00-0600│36.630001   │36.630001│36.869999│36.400002│36.709999│12464800 │
 ├─────────┼─────────────────────┼────────────┼─────────┼─────────┼─────────┼─────────┼─────────┤
 │ORCL     │2016-02-17 00:00-0600│36.630001   │36.630001│36.77    │35.970001│35.970001│13146600 │
 ├─────────┼─────────────────────┼────────────┼─────────┼─────────┼─────────┼─────────┼─────────┤
 │ORCL     │2016-02-16 00:00-0600│35.700001   │35.700001│35.91    │35.419998│35.759998│18685400 │
 ├─────────┼─────────────────────┼────────────┼─────────┼─────────┼─────────┼─────────┼─────────┤
 │ORCL     │2016-02-12 00:00-0600│35.540001   │35.540001│35.549999│34.91    │35.240002│15806800 │
 └─────────┴─────────────────────┴────────────┴─────────┴─────────┴─────────┴─────────┴─────────┘
tolbertam commented 8 years ago

Easier than I anticipated, fixed by 430c942

tolbertam commented 8 years ago

This isn't a complete fix because it only takes in account the primary key range and doesn't include the non PK restrictions. I can't tell if there is a way to solve this easily (there may not be).