Return-Path: X-Original-To: apmail-cassandra-commits-archive@www.apache.org Delivered-To: apmail-cassandra-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 01DA718782 for ; Wed, 20 Jan 2016 16:25:41 +0000 (UTC) Received: (qmail 2896 invoked by uid 500); 20 Jan 2016 16:25:40 -0000 Delivered-To: apmail-cassandra-commits-archive@cassandra.apache.org Received: (qmail 2837 invoked by uid 500); 20 Jan 2016 16:25:40 -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 2535 invoked by uid 99); 20 Jan 2016 16:25:40 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 20 Jan 2016 16:25:40 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 54B9C2C1F69 for ; Wed, 20 Jan 2016 16:25:40 +0000 (UTC) Date: Wed, 20 Jan 2016 16:25:40 +0000 (UTC) From: "Benjamin Lerer (JIRA)" To: commits@cassandra.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CASSANDRA-7281) SELECT on tuple relations are broken for mixed ASC/DESC clustering order MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CASSANDRA-7281?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15108830#comment-15108830 ] Benjamin Lerer commented on CASSANDRA-7281: ------------------------------------------- It would be perfect. :-) > SELECT on tuple relations are broken for mixed ASC/DESC clustering order > ------------------------------------------------------------------------ > > Key: CASSANDRA-7281 > URL: https://issues.apache.org/jira/browse/CASSANDRA-7281 > Project: Cassandra > Issue Type: Bug > Reporter: Sylvain Lebresne > Assignee: Marcin Szymaniuk > Fix For: 3.3, 2.2.x, 3.0.x > > Attachments: 0001-CASSANDRA-7281-SELECT-on-tuple-relations-are-broken-.patch, 0001-CASSANDRA-7281-SELECT-on-tuple-relations-are-broken-v2.patch, 0001-CASSANDRA-7281-SELECT-on-tuple-relations-are-broken-v3.patch, 0001-CASSANDRA-7281-SELECT-on-tuple-relations-are-broken-v4.patch, 0001-CASSANDRA-7281-SELECT-on-tuple-relations-are-broken-v5.patch, 7281_unit_tests.txt > > > As noted on [CASSANDRA-6875|https://issues.apache.org/jira/browse/CASSANDRA-6875?focusedCommentId=13992153&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13992153], the tuple notation is broken when the clustering order mixes ASC and DESC directives because the range of data they describe don't correspond to a single continuous slice internally. To copy the example from CASSANDRA-6875: > {noformat} > cqlsh:ks> create table foo (a int, b int, c int, PRIMARY KEY (a, b, c)) WITH CLUSTERING ORDER BY (b DESC, c ASC); > cqlsh:ks> INSERT INTO foo (a, b, c) VALUES (0, 2, 0); > cqlsh:ks> INSERT INTO foo (a, b, c) VALUES (0, 1, 0); > cqlsh:ks> INSERT INTO foo (a, b, c) VALUES (0, 1, 1); > cqlsh:ks> INSERT INTO foo (a, b, c) VALUES (0, 0, 0); > cqlsh:ks> SELECT * FROM foo WHERE a=0; > a | b | c > ---+---+--- > 0 | 2 | 0 > 0 | 1 | 0 > 0 | 1 | 1 > 0 | 0 | 0 > (4 rows) > cqlsh:ks> SELECT * FROM foo WHERE a=0 AND (b, c) > (1, 0); > a | b | c > ---+---+--- > 0 | 2 | 0 > (1 rows) > {noformat} > The last query should really return {{(0, 2, 0)}} and {{(0, 1, 1)}}. > For that specific example we should generate 2 internal slices, but I believe that with more clustering columns we may have more slices. -- This message was sent by Atlassian JIRA (v6.3.4#6332)