Cassandra query PRIMARY KEY column cannot be restricted exception -


i have table bellow:

create table vroctest.sensor_data_3 (     nodeid text,     yyyymmdd int,     hour int,     minute int,     second int,     data_timestamp bigint,     data_quality double,     data_value blob,     primary key ((nodeid, yyyymmdd), hour, minute, second, data_timestamp) 

i need below query

select nodeid, yyyymmdd, hour, minute, second, data_timestamp, data_quality, data_value vroctest.sensor_data_3  nodeid in ('331ea1eb-d536-3f37-ba6b-ae02dbc736a4') , yyyymmdd in (20160701,20160702,20170701) , hour <=24 , hour >=0 , minute <61 , minute >=0 , second >=0 , second< 61 , data_timestamp >= 1467317265000 , data_timestamp <= 1498853265000; 

however, gives me exception

com.datastax.driver.core.exceptions.invalidqueryexception: clustering column "minute" cannot restricted (preceding column "hour" restricted non-eq relation) 

the following pass. first 2 instructional. last valid form of complete query.

select * sensor_data_3       nodeid in ('331ea1eb-d536-3f37-ba6b-ae02dbc736a4')      , yyyymmdd in (20160701,20160702,20170701)      , hour in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24)      , minute <61 , minute >=0;   select * sensor_data_3     nodeid in ('331ea1eb-d536-3f37-ba6b-ae02dbc736a4')    , yyyymmdd in (20160701,20160702,20170701)    , (hour,minute) >= (0,0)    , (hour,minute) < (3,15);   select nodeid, yyyymmdd, hour, minute, second, data_timestamp, data_quality, data_value sensor_data_3       nodeid in ('331ea1eb-d536-3f37-ba6b-ae02dbc736a4')      , yyyymmdd in (20160701,20160702,20170701)      , (hour,minute,second,data_timestamp) < (24,61,61,1467317265000)      , (hour,minute,second,data_timestamp) >= (0,0,0,1498853265000); 

hour, minute, second discrete, allowing more 1 solution. cassandra, however, not know , not want hunt , peck data return. wants 1 starting point , 1 ending point per partition. @ least mental model works me.

the link provided ashraful islam excellent.


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -