Sure @dorian_yugabyte, here’s steps to reproduce
- Create table:
CREATE TABLE testjsonb (
identifier text,
timestamp timestamp,
fields jsonb,
PRIMARY KEY ((identifier), timestamp)
) WITH CLUSTERING ORDER BY (timestamp DESC);
- Insert data
insert into testjsonb(identifier,timestamp,fields)values('1','2020-07-01','{"property":"value1"}');
insert into testjsonb(identifier,timestamp,fields)values('1','2020-07-02','{"property":"value2"}');
insert into testjsonb(identifier,timestamp,fields)values('2','2020-07-02','{"property":"value3"}');
insert into testjsonb(identifier,timestamp,fields)values('3','2020-07-02','{"property":"value3"}');
insert into testjsonb(identifier,timestamp,fields)values('1','2020-07-02','{"property3":"value3"}');
insert into testjsonb(identifier,timestamp,fields)values('1','2020-07-03','{"property":"value3"}');
- Make a query
cqlsh:test> select * from testjsonb where identifier='3' and timestamp<'2020-07-03' if fields->>'property'='value3' or fields->>'property'=null;
identifier | timestamp | fields
------------+---------------------------------+-----------------------
3 | 2020-07-02 00:00:00.000000+0000 | {"property":"value3"}
Failed when
cqlsh:test> select * from testjsonb where identifier='3' and timestamp<'2020-07-03' if fields->>'property'!=null;
InvalidRequest: Error from server: code=2200 [Invalid query] message="Incomparable Datatypes. Cannot compare values of these datatypes
select * from testjsonb where identifier='3' and timestamp<'2020-07-03' if fields->>'property'!=null;
^^^^^^^^^^^^^^^^^^^^
(ql error -209)"
cqlsh:test> select * from testjsonb where identifier='3' and timestamp<'2020-07-03' if fields->>'property4'!=null;
InvalidRequest: Error from server: code=2200 [Invalid query] message="Incomparable Datatypes. Cannot compare values of these datatypes
select * from testjsonb where identifier='3' and timestamp<'2020-07-03' if fields->>'property4'!=null;
^^^^^^^^^^^^^^^^^^^^^
(ql error -209)"