Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
302 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 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...