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 E402497F9 for ; Sat, 4 Feb 2012 23:24:45 +0000 (UTC) Received: (qmail 65187 invoked by uid 500); 4 Feb 2012 23:24:43 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 65066 invoked by uid 500); 4 Feb 2012 23:24:42 -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 65057 invoked by uid 99); 4 Feb 2012 23:24:42 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 04 Feb 2012 23:24:42 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_NEUTRAL,T_FILL_THIS_FORM_SHORT X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [209.85.212.44] (HELO mail-vw0-f44.google.com) (209.85.212.44) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 04 Feb 2012 23:24:36 +0000 Received: by vbbfr13 with SMTP id fr13so3569635vbb.31 for ; Sat, 04 Feb 2012 15:24:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anconafamily.com; s=google; h=mime-version:x-originating-ip:in-reply-to:references:date :message-id:subject:from:to:content-type:content-transfer-encoding; bh=RQETau0RnFdHKtfgQ1RVmEqtNUocdc1ddcr7oO05EIU=; b=HcgxGyaSkywGlq8i+Y8jJWACGT83h9F3ilqDS2/PppzL+7aoJyppxB6ktQA92QUOo3 17jmE8B1iJKe8Ni7VVnzvUh8JWQ6h3esKMcTqW3GRdz7Yl8w1vY3NyqEKl9PsjLMbeQG LRRpSjJZcZjtTGtEcQo8w3PFEwHtgJpYm18/s= MIME-Version: 1.0 Received: by 10.52.97.34 with SMTP id dx2mr3062198vdb.54.1328397854620; Sat, 04 Feb 2012 15:24:14 -0800 (PST) Received: by 10.52.28.46 with HTTP; Sat, 4 Feb 2012 15:24:14 -0800 (PST) X-Originating-IP: [72.93.223.217] In-Reply-To: References: <6BC865B0-908C-4689-9D1F-82979DC55C61@mindspring.com> Date: Sat, 4 Feb 2012 18:24:14 -0500 Message-ID: Subject: Re: yet a couple more questions on composite columns From: Jim Ancona To: user@cassandra.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable I've used "special" values which still comply with the Composite schema for the metadata columns, e.g. a column of 1970-01-01:{accountId} for a metadata column where the Composite is DateType:UTF8Type. Jim On Sat, Feb 4, 2012 at 2:13 PM, Yiming Sun wrote: > Thanks Andrey and Chris. =A0It sounds like we don't necessarily have to u= se > composite columns. =A0From what I understand about dynamic CF, each row m= ay > have completely different data from other rows; =A0but in our case, the d= ata > in each row is similar to other rows; my concern was more about the > homogeneity of the data between columns. > > In our original supercolumn-based schema, one special supercolumn is call= ed > "metadata" which contains a number of subcolumns to hold metadata describ= ing > each collection (e.g. number of documents, etc.), then the rest of the > supercolumns in the same row are all IDs of documents belong to the > collection, and for each document supercolumn, the subcolumns contain the > document content as well as metadata on individual document (e.g. checksu= m > of each document). > > To move away from the supercolumn schema, I could either create two CFs, = one > to hold metadata, the other document content; or I could create just one = CF > mixing metadata and doc content in the same row, and using composite colu= mn > names to identify if the particular column is metadata or a document. =A0= I am > just wondering if you have any inputs on the pros and cons of each schema= . > > -- Y. > > > On Fri, Feb 3, 2012 at 10:27 PM, Chris Gerken > wrote: >> >> >> >> >> On 4 February 2012 06:21, Yiming Sun wrote: >>> >>> I cannot have one composite column name with 3 components while another >>> with 4 components? >> >> =A0Just put 4 components and left last empty (if it is same type)?! >> >>> Another question I have is how flexible composite columns actually are. >>> =A0If my data model has a CF containing US zip codes with the following >>> composite columns: >>> >>> {OH:Spring Field} : 45503 >>> {OH:Columbus} : 43085 >>> {FL:Spring Field} : 32401 >>> {FL:Key West} =A0: 33040 >>> >>> I know I can ask cassandra to "give me the zip codes of all cities in >>> OH". =A0But can I ask it to "give me the zip codes of all cities named = Spring >>> Field" using this model? =A0Thanks. >> >> No. You set first composite component at first. >> >> >> I'd use a dynamic CF: >> row key =3D state abbreviation >> column name =3D city name >> column value =3D zip code (or a complex object, one of whose properties = is >> zip code) >> >> you can iterate over the columns in a single row to get a state's city >> names and their zip code and you can do a get_range_slices on all keys f= or >> the columns starting and ending on the city name to find out the zip cod= es >> for a cities with the given name. >> >> I think >> >> - Chris > >