Return-Path: X-Original-To: apmail-cassandra-dev-archive@www.apache.org Delivered-To: apmail-cassandra-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 680A0783F for ; Mon, 29 Aug 2011 11:42:14 +0000 (UTC) Received: (qmail 8080 invoked by uid 500); 29 Aug 2011 11:42:13 -0000 Delivered-To: apmail-cassandra-dev-archive@cassandra.apache.org Received: (qmail 7181 invoked by uid 500); 29 Aug 2011 11:42:04 -0000 Mailing-List: contact dev-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 dev@cassandra.apache.org Received: (qmail 7133 invoked by uid 99); 29 Aug 2011 11:42:02 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 29 Aug 2011 11:42:02 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of sylvain@datastax.com designates 209.85.161.172 as permitted sender) Received: from [209.85.161.172] (HELO mail-gx0-f172.google.com) (209.85.161.172) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 29 Aug 2011 11:41:57 +0000 Received: by gxk19 with SMTP id 19so5492680gxk.31 for ; Mon, 29 Aug 2011 04:41:36 -0700 (PDT) Received: by 10.236.189.42 with SMTP id b30mr24358727yhn.73.1314618096100; Mon, 29 Aug 2011 04:41:36 -0700 (PDT) MIME-Version: 1.0 Received: by 10.236.108.52 with HTTP; Mon, 29 Aug 2011 04:41:15 -0700 (PDT) X-Originating-IP: [88.183.33.171] In-Reply-To: <1313106794.3184.5.camel@greenlantern.local> References: <1313021069.28827.17.camel@greenlantern.local> <1313030454.3184.2.camel@greenlantern.local> <1313106794.3184.5.camel@greenlantern.local> From: Sylvain Lebresne Date: Mon, 29 Aug 2011 13:41:15 +0200 Message-ID: Subject: Re: Possible Bug in 0.8.2 with DynamicComposite range scans? To: dev@cassandra.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On Fri, Aug 12, 2011 at 1:53 AM, Todd Nine wrote: > Hi Sylvain, > =A0Could you share the command you used to create the CF with the > pre-defined aliases? =A0I'm constantly receiving this error when I use th= e > following command. > > Syntax error at position 63: missing EOF at '(' > > > create column family test2 with > comparator=3DDynamicCompositeType(a=3D>AsciiType,b=3D>BytesType,i=3D>Inte= gerType,x=3D>LexicalUUIDType,l=3D>LongType,t=3D>TimeUUIDType,s=3D>UTF8Type,= u=3D>UUIDType,A=3D>AsciiType(reversed=3Dtrue),B=3D>BytesType(reversed=3Dtru= e),I=3D>IntegerType(reversed=3Dtrue),X=3D>LexicalUUIDType(reversed=3Dtrue),= L=3D>LongType(reversed=3Dtrue),T=3D>TimeUUIDType(reversed=3Dtrue),S=3D>UTF8= Type(reversed=3Dtrue),U=3D>UUIDType(reversed=3Dtrue)) =A0and key_validation= _class=3DAsciiType and default_validation_class=3DAsciiType; > > I'll keep digging. =A0I have a it's most likely a disconnect between the > serialization of the type aliases on the client and the treatment of > aliases in Cassandra. I think you're missing quotes. Try comparator=3D'DynamicCompositeType(a=3D>AsciiType,b=3D>BytesType,...)'. Tha= t worked for me. -- Sylvain > > > Thanks, > Todd > > > On Thu, 2011-08-11 at 10:57 +0200, Sylvain Lebresne wrote: > >> I've tried using the longer values (converted as hex, so respectively >> 0000012D3FDFA400 and 0000012D4E52B800, since that is what >> the CLI can understand) and with the exact DynamicCompositeType >> declaration above (almost exact, I've fixed DynamicComposite -> >> DynamicCompositeType). I've tried with and without actually using >> the aliases (that is, I tried with the aliases declared but without usin= g >> them in the values I sent). I always got the right. I really think this >> is on the hector side at this point. >> >> >> When performing the range scan for my test the method >> >> "getColumnComparator" on line 106 of the SliceQueryFilter is invoked. >> >> It's using the BytesType comparator, so it is comparing the second >> >> component. >> >> Well, maybe the problem is when you declare the column family then. >> Are you set you correctly set the DynamicCompositeType when you >> create the column family (check with the CLI maybe, using describe keysp= ace). >> >> Because the getColumnComparator should return the DynamicCompositeType, >> not BytesType. The comparison of the different component is done interna= lly >> in DynamicCompositeType. >> >> >> However, the "reversed" boolean flag is set to false, so it's not >> >> correctly utilizing the columeReverseComparator instance when >> >> performing range scans. >> >> This is right, because the slice query itself is not reversed. Again, th= e >> comparison is internal to DynamicCompositeType that will use the Reverse= Type >> comparator to compare the second component. >> >> -- >> Sylvain >> >> >> This seems to be a disconnect between when a column is specified as >> >> "reversed" in the component itself, and reversed is specified in the >> >> range query. =A0For each component, wouldn't you need to do this? >> >> >> >> reversed =3D user reversed ^ composite reversed >> >> >> >> This is the table I came up with for range scanning. =A0True is forwa= rd, >> >> false is reverse >> >> >> >> User =A0 =A0Component =A0 =A0Scan direction >> >> false =A0 false =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 false >> >> false =A0 true =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 tr= ue >> >> true =A0 =A0 false =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 tr= ue >> >> true =A0 =A0 true =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= false >> >> >> >> >> >> >> >> >> >> Thanks, >> >> >> >> >> >> -- >> >> todd >> >> CHIEF SOFTWARE ENGINEER >> >> >> >> todd nine| spidertracks ltd | =A0117a the square >> >> po box 5203 | palmerston north 4441 | new zealand >> >> P: +64 6 353 3395 >> >> E: todd@spidertracks.co.nz W: www.spidertracks.com >> >> >> >> >> >> >> >> On Wed, 2011-08-10 at 12:26 +0200, Sylvain Lebresne wrote: >> >> > Well, this seem to be on the hector side. >> >> > >> >> > I've tried the same example using the CLI, and: >> >> > >> >> > [default@unknown] create keyspace test; >> >> > 642e6f90-c336-11e0-0000-242d50cf1fd5 >> >> > Waiting for schema agreement... >> >> > ... schemas agree across the cluster >> >> > [default@unknown] use test; >> >> > Authenticated to keyspace: test >> >> > [default@test] create column family foobar with >> >> > comparator=3DDynamicCompositeType and key_validation_class=3DAsciiT= ype and >> >> > default_validation_class=3DAsciiType; >> >> > 40032380-c337-11e0-0000-242d50cf1fd5 >> >> > Waiting for schema agreement... >> >> > ... schemas agree across the cluster >> >> > [default@test] set foobar[k]['UTF8Type@jeans:BytesType(reversed=3Dt= rue)@1'] =3D a; >> >> > Value inserted. >> >> > [default@test] get foobar[k]; >> >> > =3D> (column=3DUTF8Type@jeans:BytesType(reversed=3Dtrue)@01, value= =3Da, >> >> > timestamp=3D1312970389512000) >> >> > Returned 1 results. >> >> > [default@test] set foobar[k]['UTF8Type@jeans:BytesType(reversed=3Dt= rue)@2'] =3D a; >> >> > Value inserted. >> >> > [default@test] get foobar[k]; >> >> > =3D> (column=3DUTF8Type@jeans:BytesType(reversed=3Dtrue)@02, value= =3Da, >> >> > timestamp=3D1312970410712000) >> >> > =3D> (column=3DUTF8Type@jeans:BytesType(reversed=3Dtrue)@01, value= =3Da, >> >> > timestamp=3D1312970389512000) >> >> > Returned 2 results. >> >> > >> >> > Now, the last query is not exactly the one you do, since it does a = full row >> >> > query but the CLI don't support setting the start and end of a slic= e. However, >> >> > I have tried hard-coding the exact query into the CLI (with >> >> > start=3D'UTF8Type@jeans' >> >> > and end=3D'UTF8Type@jeans:!'), and it still returns the columns in = the columns >> >> > in the right order (with the biggest second component first). >> >> > >> >> > -- >> >> > Sylvain >> >> > >> >> > On Wed, Aug 10, 2011 at 9:26 AM, Todd Nine = wrote: >> >> > > Hi guys, >> >> > > =A0 I've been dealing with a problem in my JPA plugin for a coupl= e days >> >> > > now. =A0I've been able to create a native test in 0.8.2 that repr= oduces >> >> > > the issue. =A0Here is the test. >> >> > > >> >> > > >> >> > > https://gist.github.com/3ce70eab8102d2555626 >> >> > > >> >> > > >> >> > > Essentially, here is what is happening. >> >> > > >> >> > > A dynamic composite with the following ordering is created in a c= olumn >> >> > > >> >> > > UTF8Type+BytesType(reversed=3D >> >> > > true). >> >> > > >> >> > > 2 columns are then inserted, without composite encoding, these ar= e the 2 values >> >> > > >> >> > > "jeans" + 1293840000000L >> >> > > >> >> > > "jeans" + 1294099200000L >> >> > > >> >> > > >> >> > > Here are the byte values (with spaces added to make the encoding = of >> >> > > the composite easier to read) =A0The format is 4 byte comparator,= 4 byte >> >> > > length, n field bytes, 1 byte comparator, then repeats >> >> > > >> >> > > Inserted: >> >> > > >> >> > > 8073 0005 6a65616e73 00 =A0 =A08042 0008 0000012d4b889b80 00 >> >> > > 8073 0005 6a65616e73 00 =A0 =A08042 0008 0000012d3c158780 00 >> >> > > >> >> > > Query start >> >> > > >> >> > > 8073 0005 6a65616e73 00 >> >> > > >> >> > > Query end >> >> > > >> >> > > 8073 0005 6a65616e73 01 >> >> > > >> >> > > Returned from Hector Results >> >> > > >> >> > > 8073 0005 6a65616e73 00 =A0 =A08042 0008 0000012d3c158780 00 >> >> > > 8073 0005 6a65616e73 00 =A0 =A08042 0008 0000012d4b889b80 00 >> >> > > >> >> > > >> >> > > Given that the first value is sorted normally, and the second val= ue is >> >> > > reversed, I would expect the higher long value to appear before t= he >> >> > > lower one (the longs are dates) when the first value in the compo= site >> >> > > is equal. =A0Is this the expected behavior, or is this a bug? >> >> > > >> >> > > Thanks, >> >> > > Todd >> >> > > >> > >> > >