I'm going through "DS220: DataStax Enterprise 6 Practical Application Data Modeling with Apache Cassandra™" --> "Clustering Column" --> Exercise
Executing below command and can anyone help me understand why I'm getting below error:
InvalidRequest: Error from server: code=2200 [Invalid query] message="Cannot execute this query as it might involve data filtering and thus may have unpredictable performance. If you want to execute this query despite the performance unpredictability, use ALLOW FILTERING"
Below are query which I'm executing:
cqlsh:killrvideo> drop table killrvideo.videos_by_tag_year; cqlsh:killrvideo> CREATE TABLE videos_by_tag_year ( ... tag text, ... added_year int, ... video_id timeuuid, ... added_date timestamp, ... description text, ... title text, ... user_id uuid, ... PRIMARY KEY ((tag, video_id), added_year) ... ) WITH CLUSTERING ORDER BY (added_year desc);
cqlsh:killrvideo> COPY videos_by_tag_year (tag, added_year, video_id, added_date, description, title, user_id) FROM 'videos_by_tag_year.csv' WITH HEADER=true; Using 1 child processes Starting copy of killrvideo.videos_by_tag_year with columns [tag, added_year, video_id, added_date, description, title, user_id]. Processed: 797 rows; Rate: 723 rows/s; Avg. rate: 1219 rows/s 797 rows imported from 1 files in 0.654 seconds (0 skipped).
cqlsh:killrvideo> select count(*) from killrvideo.videos_by_tag_year ; count ------- 797 (1 rows) Warnings : Aggregation query used without partition key
cqlsh:killrvideo> select * from killrvideo.videos_by_tag_year where tag = 'cql'; InvalidRequest: Error from server: code=2200 [Invalid query] message="Cannot execute this query as it might involve data filtering and thus may have unpredictable performance. If you want to execute this query despite the performance unpredictability, use ALLOW FILTERING"
cqlsh:killrvideo> select * from killrvideo.videos_by_tag_year where tag = 'cql' and added_year = 2015; InvalidRequest: Error from server: code=2200 [Invalid query] message="Cannot execute this query as it might involve data filtering and thus may have unpredictable performance. If you want to execute this query despite the performance unpredictability, use ALLOW FILTERING"
We defined partition key on tag and video_id and tag can be used in filter condition also defined clustering key on added_year