Skip to content

Instantly share code, notes, and snippets.

@iwankgb
Created June 1, 2016 11:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iwankgb/2fd9c6dad66034a9144390cf1abfd6d6 to your computer and use it in GitHub Desktop.
Save iwankgb/2fd9c6dad66034a9144390cf1abfd6d6 to your computer and use it in GitHub Desktop.
CREATE TABLE db.broken_table (
text_field text,
integer_field int,
another_text_field text,
date timestamp,
some_random_text text,
PRIMARY KEY ((text_field, integer_field, another_text_field), date)
) WITH CLUSTERING ORDER BY (date ASC)
AND bloom_filter_fp_chance = 0.01
AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'}
AND comment = ''
AND compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold': '32', 'min_threshold': '4'}
AND compression = {'chunk_length_in_kb': '64', 'class': 'org.apache.cassandra.io.compress.LZ4Compressor'}
AND crc_check_chance = 1.0
AND dclocal_read_repair_chance = 0.1
AND default_time_to_live = 0
AND gc_grace_seconds = 864000
AND max_index_interval = 2048
AND memtable_flush_period_in_ms = 0
AND min_index_interval = 128
AND read_repair_chance = 0.0
AND speculative_retry = '99PERCENTILE';
CREATE CUSTOM INDEX broken ON db.broken_table (text_field) USING 'org.apache.cassandra.index.sasi.SASIIndex';
CREATE CUSTOM INDEX working ON db.broken_table (some_random_text) USING 'org.apache.cassandra.index.sasi.SASIIndex';
cqlsh:db> insert into broken_table (text_field, integer_field , another_text_field , date , some_random_text ) values ('Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus a hendrerit enim. Aenean ultricies ex orci, vitae pellentesque leo consequat eget.', 303, 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus a hendrerit enim. Aenean ultricies ex orci, vitae pellentesque leo consequat eget.', toTimestamp(now()), 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus a hendrerit enim. Aenean ultricies ex orci, vitae pellentesque leo consequat eget.');
cqlsh:db> select integer_field from broken_table where some_random_text like 'Lorem%';
integer_field
---------------
303
(1 rows)
cqlsh:db> select integer_field from broken_table where text_field like 'Lorem%';
integer_field
---------------
(0 rows)
cqlsh:db> select integer_field from broken_table where text_field like 'Lorem%' allow filtering;
integer_field
---------------
(0 rows)
cqlsh:db> drop index broken;
cqlsh:db> select integer_field from broken_table where text_field like 'Lorem%' allow filtering;
InvalidRequest: code=2200 [Invalid query] message="text_field LIKE '<term>%' restriction is only supported on properly indexed columns"
cqlsh:db> select integer_field from broken_table where text_field like 'Lorem%';
InvalidRequest: code=2200 [Invalid query] message="text_field LIKE '<term>%' restriction is only supported on properly indexed columns"
cqlsh:db>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment