Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 6993B200B8B for ; Tue, 4 Oct 2016 16:07:22 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 68392160AC9; Tue, 4 Oct 2016 14:07:22 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id AE98B160AC5 for ; Tue, 4 Oct 2016 16:07:21 +0200 (CEST) Received: (qmail 57595 invoked by uid 500); 4 Oct 2016 14:07:20 -0000 Mailing-List: contact commits-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cassandra.apache.org Delivered-To: mailing list commits@cassandra.apache.org Received: (qmail 57582 invoked by uid 99); 4 Oct 2016 14:07:20 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Oct 2016 14:07:20 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 8FD162C2A64 for ; Tue, 4 Oct 2016 14:07:20 +0000 (UTC) Date: Tue, 4 Oct 2016 14:07:20 +0000 (UTC) From: "Alex Petrov (JIRA)" To: commits@cassandra.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CASSANDRA-12149) NullPointerException on SELECT using index with token restrictions fully overriden by other PK restrictions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Tue, 04 Oct 2016 14:07:22 -0000 [ https://issues.apache.org/jira/browse/CASSANDRA-12149?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15545436#comment-15545436 ] Alex Petrov commented on CASSANDRA-12149: ----------------------------------------- This problem was not related strictly to SASI, so I have adjusted the title accordingly. Example code that'd fail: {code} @Test public void testTokenAndIndex() throws Throwable { createTable("CREATE TABLE %s (a int, b int, c int, d int, PRIMARY KEY (a, b, c))"); createIndex("CREATE INDEX ON %s(c)"); for (int i = 0; i < 10; i++) { execute("INSERT INTO %s (a,b,c,d) VALUES (?, ?, ?, ?)", i, i, i, i); execute("INSERT INTO %s (a,b,c,d) VALUES (?, ?, ?, ?)", i, i + 10, i + 10, i + 10); } beforeAndAfterFlush(() -> { assertRows(execute("SELECT * FROM %s WHERE token(a) > token(8) AND a = 9 AND c = 9 ALLOW FILTERING"), row(9, 9, 9, 9)); assertRows(execute("SELECT * FROM %s WHERE token(a) > token(8) AND a > 8 ALLOW FILTERING"), row(9, 9, 9, 9), row(9, 19, 19, 19)); }); } {code} We could use non-token restrictions when token restrictions are fully overriden by other results. |[12419-trunk|https://github.com/ifesdjeen/cassandra/tree/12419-trunk]|[dtest|http://cassci.datastax.com/job/ifesdjeen-12419-trunk-dtest/]|[utest|http://cassci.datastax.com/job/ifesdjeen-12419-trunk-testall/]| |[12419-3.0|https://github.com/ifesdjeen/cassandra/tree/12419-3.0]|[dtest|http://cassci.datastax.com/job/ifesdjeen-12419-3.0-dtest/]|[utest|http://cassci.datastax.com/job/ifesdjeen-12419-3.0-testall/]| |[12419-3.X|https://github.com/ifesdjeen/cassandra/tree/12419-3.X]|[dtest|http://cassci.datastax.com/job/ifesdjeen-12419-3.X-dtest/]|[utest|http://cassci.datastax.com/job/ifesdjeen-12419-3.X-testall/]| > NullPointerException on SELECT using index with token restrictions fully overriden by other PK restrictions > ------------------------------------------------------------------------------------------------------------ > > Key: CASSANDRA-12149 > URL: https://issues.apache.org/jira/browse/CASSANDRA-12149 > Project: Cassandra > Issue Type: Bug > Reporter: Andrey Konstantinov > Assignee: Alex Petrov > Attachments: CASSANDRA-12149.txt > > > If I execute the sequence of queries (see the attached file), Cassandra aborts a connection reporting NPE on server side. SELECT query without token range filter works, but does not work when token range filter is specified. My intent was to issue multiple SELECT queries targeting the same single partition, filtered by a column indexed by SASI, partitioning results by different token ranges. > Output from cqlsh on SELECT is the following: > {code} > cqlsh> SELECT namespace, entity, timestamp, feature1, feature2 FROM mykeyspace.myrecordtable WHERE namespace = 'ns2' AND entity = 'entity2' AND feature1 > 11 AND feature1 < 31 AND token(namespace, entity) <= 9223372036854775807; > ServerError: > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)