Return-Path: X-Original-To: apmail-cassandra-user-archive@www.apache.org Delivered-To: apmail-cassandra-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4B39A91D1 for ; Wed, 8 Feb 2012 17:17:30 +0000 (UTC) Received: (qmail 45471 invoked by uid 500); 8 Feb 2012 17:17:28 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 45404 invoked by uid 500); 8 Feb 2012 17:17:27 -0000 Mailing-List: contact user-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cassandra.apache.org Delivered-To: mailing list user@cassandra.apache.org Received: (qmail 45396 invoked by uid 99); 8 Feb 2012 17:17:27 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 08 Feb 2012 17:17:27 +0000 X-ASF-Spam-Status: No, hits=-1.6 required=5.0 tests=RCVD_IN_DNSWL_MED,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [130.202.113.50] (HELO mailhost.anl.gov) (130.202.113.50) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 08 Feb 2012 17:17:19 +0000 Received: from mailhost.anl.gov (mailhost.anl.gov [130.202.113.50]) by localhost.anl.gov (Postfix) with ESMTP id 6D9A217 for ; Wed, 8 Feb 2012 11:16:58 -0600 (CST) Received: from zimbra.anl.gov (zimbra.anl.gov [130.202.101.12]) by mailhost.anl.gov (Postfix) with ESMTP id 475ED42 for ; Wed, 8 Feb 2012 11:16:58 -0600 (CST) Received: from localhost (localhost.localdomain [127.0.0.1]) by zimbra.anl.gov (Postfix) with ESMTP id 41EFD1262E for ; Wed, 8 Feb 2012 11:16:58 -0600 (CST) X-Virus-Scanned: amavisd-new at zimbra.anl.gov Received: from zimbra.anl.gov ([127.0.0.1]) by localhost (zimbra.anl.gov [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id VZsQhY9goztG for ; Wed, 8 Feb 2012 11:16:58 -0600 (CST) Received: from bda-uc-laptop (bda-uc-laptop.mcs.anl.gov [140.221.11.14]) by zimbra.anl.gov (Postfix) with ESMTPSA id 1DF3A12603 for ; Wed, 8 Feb 2012 11:16:58 -0600 (CST) Date: Wed, 8 Feb 2012 11:16:57 -0600 From: Bryce Allen To: user@cassandra.apache.org Subject: Re: cli composite type literal with empty string component Message-ID: <20120208111657.2cde22f6@bda-uc-laptop> In-Reply-To: <20120208105937.15f51951@bda-uc-laptop> References: <20120208102507.0d85849e@bda-uc-laptop> <20120208105937.15f51951@bda-uc-laptop> X-Mailer: Claws Mail 3.8.0 (GTK+ 2.24.9; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: multipart/signed; micalg=PGP-SHA1; boundary="Sig_/u_m7/6AaLyuC8/pBoQwUtnY"; protocol="application/pgp-signature" X-Virus-Checked: Checked by ClamAV on apache.org --Sig_/u_m7/6AaLyuC8/pBoQwUtnY Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable In case anyone else is curious about what is going on here: https://github.com/pycassa/pycassa/issues/112 The links to the Cassandra JIRA are instructive. -Bryce On Wed, 8 Feb 2012 10:59:37 -0600 Bryce Allen wrote: > Never mind; the issue with addressing composite column names with > empty components was fixed in the latest pycassa, which is why I was > even able to create them in the Test3 schema below. I get an error in > 1.2.1 which I used to be running, but it all seems to work in 1.4.0. >=20 > -Bryce >=20 > On Wed, 8 Feb 2012 10:25:07 -0600 > Bryce Allen wrote: > > I have a CF defined like this in CLI syntax: > >=20 > > create column family Test > > with key_validation_class =3D UTF8Type > > and comparator =3D 'CompositeType(AsciiType, UTF8Type)' > > and default_validation_class =3D UTF8Type > > and column_metadata =3D [ > > { column_name : 'deleted:', > > validation_class : BooleanType }, > > { column_name : 'version:', > > validation_class : LongType }, > > ]; > >=20 > > I expected these columns to map to ("deleted", "") and ("version", > > "") in pycassa, but this is not the case: > >=20 > > TEST.insert("r1", { ("deleted", ""): False, ("version", ""): 1, > > ("a", "b"): "c" }) > > AttributeError: 'int' object has no attribute 'encode' > >=20 > > TEST.column_validators > > {'\x00\x07deleted\x00': 'BooleanType', > > '\x00\x07version\x00': 'LongType'} > >=20 > > The obvious workaround is to use pycassa to define the schema: > >=20 > > SYSTEM_MANAGER.create_column_family("test", "Test2", > > key_validation_class=3DUTF8_TYPE, > > comparator_type=3DCompositeType(ASCII_TYPE, UTF8_TYPE), > > default_validation_class=3DUTF8_TYPE, > > column_validation_classes=3D{ > > ("version", ""): LONG_TYPE, > > ("deleted", ""): BOOLEAN_TYPE }) > >=20 > > and this does really produce a different schema: > > =20 > > TEST2.column_validators > > {'\x00\x07version\x00\x00\x00\x00': 'LongType', > > '\x00\x07deleted\x00\x00\x00\x00': 'BooleanType'} > >=20 > > To mimic what CLI does, I leave off the last component instead of > > using "": > >=20 > > SYSTEM_MANAGER.create_column_family("test", "Test3", > > key_validation_class=3DUTF8_TYPE, > > comparator_type=3DCompositeType(ASCII_TYPE, UTF8_TYPE), > > default_validation_class=3DUTF8_TYPE, > > column_validation_classes=3D{ > > ("version",): LONG_TYPE, > > ("deleted",): BOOLEAN_TYPE }) > >=20 > > TEST3.column_validators > > {'\x00\x07deleted\x00': 'BooleanType', > > '\x00\x07version\x00': 'LongType'} > >=20 > > But I see no way to address these columns from pycassa. I have a > > workaround, but I find the inconsistency perplexing, and would > > rather not have to do the busywork to convert my schema syntax. Is > > there a way to address columns with an empty string component in > > the CLI? > >=20 > > Thanks, > > Bryce --Sig_/u_m7/6AaLyuC8/pBoQwUtnY Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iQEcBAEBAgAGBQJPMq4JAAoJEH7TXFS3IEdZiyQH/1m20tdOfC3oepGxUJWAh4bX 52juZd/dpwCbDNxzzqYBl4WwT/RJEKUG5cIlw8nh22RBnFO7IiCBlyEPGhta6Aiz TkM/W0ld+YXp+FsWl0hHykaegfNHBrezzpJqcRdeqILrwO78dnR3o532/UfIz4CT me8qsoWpBAdia1M9PSfm5Ew/KWR0jFKKfOtYSZe3FjOMLV95iWmcOn+EFuSXhMFs M77gSHMEI1Ajzp2pzYXYoSXlzEAgufNdWkeFdWkbU5w5AsuP8jQGC9KNp9Hy5QrU engWzlSQlxEgGc57IPQM3GyFP0vMwurhThVhLl2DJmZYd8KatWTqySUkN5dCA5s= =J4be -----END PGP SIGNATURE----- --Sig_/u_m7/6AaLyuC8/pBoQwUtnY--