Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
326 views
in Technique[技术] by (71.8m points)

cql - Cassandra <= on a time column

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?

question from:https://stackoverflow.com/questions/65843816/cassandra-on-a-time-column

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...