[ https://issues.apache.org/jira/browse/CASSANDRA-14344?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16593474#comment-16593474 ]
Venkata Harikrishna Nukala commented on CASSANDRA-14344: -------------------------------------------------------- Found another good reason to have a separate class for evaluating IN expression. And i.e. if we run a query having IN clause with single null value, something like below, {code}SELECT * FROM t1 WHERE col2 IN (null) ALLOW FILTERING;{code} then it throws an error message saying: {code}InvalidRequest: Error from server: code=2200 [Invalid query] message="Unsupported null value for column col2"{code} I feel we should throw the same error message even for a query having IN clause with multiple values. Something like: {code}SELECT * FROM t2 WHERE c2 IN (10, null) ALLOW FILTERING;{code} If we serialize the values into a single buffer, then we cannot do such validation. Values should be inspected individually to do it. So, created a new class for it so that validation is performed in its own manner and evaluation is performed optimally. Avoided new value in {{Expression.Kind}} enum to avoid impact on serialization and deserialization. Attached patch [^14344-trunk-inexpression-approach-2.txt] with required changes. > Support filtering using IN restrictions > --------------------------------------- > > Key: CASSANDRA-14344 > URL: https://issues.apache.org/jira/browse/CASSANDRA-14344 > Project: Cassandra > Issue Type: New Feature > Reporter: Dikang Gu > Assignee: Venkata Harikrishna Nukala > Priority: Major > Attachments: 14344-trunk-2.txt, > 14344-trunk-inexpression-approach-2.txt, > 14344-trunk-inexpression-approach.txt, 14344-trunk.txt > > > Support IN filter query like this: > > 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) > > 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; > *{color:#ff0000}InvalidRequest: Error from server: code=2200 [Invalid query] > message="IN restrictions are not supported on indexed columns"{color}* > cqlsh:ks1> -- This message was sent by Atlassian JIRA (v7.6.3#76005) --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org