osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: IN restrictions are not supported on indexed columns


There are not real blocker I believe. It is just that we never implemented
it.

On Fri, Mar 23, 2018 at 6:08 PM, Dikang Gu <dikang85@xxxxxxxxx> wrote:

> Hello C* developers:
>
> I have one question, does anyone know why we can not support the IN
> restrictions on indexed columns? Is it just because no one is working it?
> Or are there any other reasons?
>
> Below is an example query:
> ====
>
> cqlsh:ks1> describe keyspace;
>
> CREATE KEYSPACE ks1 WITH replication = {'class': 'SimpleStrategy',
> 'replication_factor': '1'}  AND durable_writes = true;
>
> CREATE TABLE ks1.t1 (
>     key int,
>     col1 int,
>     col2 int,
>     value int,
>     PRIMARY KEY (key, col1, col2)
> ) WITH CLUSTERING ORDER BY (col1 ASC, col2 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';
>
> cqlsh:ks1> select * from t1 where key = 1 and col2 in (1) allow filtering;
>
>  key | col1 | col2 | value
> -----+------+------+-------
>    1 |    1 |    1 |     1
>    1 |    2 |    1 |     3
>
> (2 rows)
> cqlsh:ks1> select * from t1 where key = 1 and col2 in (1, 2) allow
> filtering;
> *InvalidRequest: Error from server: code=2200 [Invalid query] message="IN
> restrictions are not supported on indexed columns"*
> cqlsh:ks1>
> =====
>
> Thanks
>
>
> --
> Dikang
>