0

I have a Cassandra table that looks something like this

  VmwareVirtualMachine | 2020-04-24 02:04:57+0000
  VmwareVirtualMachine | 2020-05-14 06:02:23+0000
  VmwareVirtualMachine | 2020-05-14 06:02:23+0000
  VmwareVirtualMachine | 2020-06-26 13:19:03+0000
  VmwareVirtualMachine | 2020-06-29 06:14:00+0000

My requirement is to print all rows that are less than or equal to 2020-05-14 06:02:23+0000

My query is:

cqlsh -ksd -e "select type, timevalue from table_one where timevalue != null and timevalue<='2020-05-14 06:02:23+0000'"

It prints

 VmwareVirtualMachine | 2020-04-24 02:04:57+0000

Since I gave <= I expected it to print

  VmwareVirtualMachine | 2020-04-24 02:04:57+0000
  VmwareVirtualMachine | 2020-05-14 06:02:23+0000
  VmwareVirtualMachine | 2020-05-14 06:02:23+0000

If I do something like this:

cqlsh -ksd -e "select type, timevalue from table_one where timevalue != null and timevalue<='2020-05-14 06:02:24+0000'"

It prints the first 3 rows if I increase the time by a second. Not sure why less than or not equal to does not work in my statement.

Any help?

  • 1
    print timestamps with milliseconds resolution - most probably it's not `2020-05-14 06:02:23+0000`, but like `2020-05-14 06:02:23.123+0000` – Alex Ott Jan 22 '21 at 11:49
  • I think @AlexOtt is correct. Check my answer to a similar question here: https://stackoverflow.com/questions/28547616/cassandra-cqlsh-how-to-show-microseconds-milliseconds-for-timestamp-columns/28549241#28549241 – Aaron Jan 22 '21 at 13:54

0 Answers0