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 0875FDB08 for ; Sun, 7 Oct 2012 23:05:15 +0000 (UTC) Received: (qmail 93235 invoked by uid 500); 7 Oct 2012 23:05:12 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 93204 invoked by uid 500); 7 Oct 2012 23:05:12 -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 93196 invoked by uid 99); 7 Oct 2012 23:05:12 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 07 Oct 2012 23:05:12 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [209.85.160.44] (HELO mail-pb0-f44.google.com) (209.85.160.44) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 07 Oct 2012 23:05:04 +0000 Received: by mail-pb0-f44.google.com with SMTP id ro8so3541992pbb.31 for ; Sun, 07 Oct 2012 16:04:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-originating-ip:in-reply-to:references:date :message-id:subject:from:to:content-type:x-gm-message-state; bh=D8EiZxFDgYYe/HCB1PP9uYm0RX+vjdzWSPvdXPnDSmk=; b=aaZ7nk7tyWNNqxe6KbeFMj1mCigzmi4gKEhO2E+55ZQS+OLemwNmJ2CoYMIK8VbEnJ +IQKvijI0bkaI2mBBwcMNVZccnpoRZNVmyVlcGAWeAJH6Wb5POJrd01dN9m/Tglbb9bQ Gymx69GgY2MqX2ZguKKjmmjBePFStWjbI4tqx22QgdrvuBb4s0cPKTzf4MdnV71kKtKe 0nXoQSDHT6b2nivp90HOHpeo+0GiUjS4CsqcQGh+r33ddXDaVO4oU/5Q+Yp4hWPLi2EF Lm0Kt617vHGZr2ABrTmxmkh+aot+Vgn1E2GfCplaN7y47gNXNR4xxylEMhSzlPnWiMFN 1iXA== MIME-Version: 1.0 Received: by 10.68.235.71 with SMTP id uk7mr48654539pbc.10.1349651082565; Sun, 07 Oct 2012 16:04:42 -0700 (PDT) Received: by 10.66.79.194 with HTTP; Sun, 7 Oct 2012 16:04:42 -0700 (PDT) X-Originating-IP: [207.237.114.92] In-Reply-To: References: <62429F36-D470-43DA-A9EB-90CB21E160A9@thelastpickle.com> Date: Sun, 7 Oct 2012 19:04:42 -0400 Message-ID: Subject: Re: cql3 and cli composites columns From: Tupshin Harper To: user@cassandra.apache.org Content-Type: text/plain; charset=ISO-8859-1 X-Gm-Message-State: ALoCoQmE+EWpzXPWS60jcFFPqcKgdTW6JeBlai48dePAOBp+yRdXHyLzcjg1S0Hl4dAWTq4HlAUc Once you have created the CF from cqlsh, switch over to cassandra-cli and run "describe schema". It will show you the schema for all your column families in syntax that can be passed back into cassandra-cli to create them. The cassandr-cli syntax that you are looking for is probably the "and column_metadata =" section. -Tupshin On Sun, Oct 7, 2012 at 4:43 PM, Cyril Auburtin wrote: > Thanks Aaron, > I don't understand what is the cli equivalent of: > > CREATE TABLE timeline ( > user_id varchar, > tweet_id bigint, > author varchar, > body varchar, > PRIMARY KEY (user_id, tweet_id) > ); > > > > 2012/10/3 aaron morton >> >> > If it's just a printing issue it's really minor though >> >> I would guess because timeline CF has defined columns and line CF does >> not. >> >> All cqlsh knows is that every column name has two parts, it does not know >> what the column names will be. The difference between a static and dynamic >> CF. >> >> Hope that helps. >> >> ----------------- >> Aaron Morton >> Freelance Developer >> @aaronmorton >> http://www.thelastpickle.com >> >> On 2/10/2012, at 10:37 PM, Cyril Auburtin >> wrote: >> >> > I wanted to know why the highlighted sections below are printed >> > differently, the 2 column families are the same >> > >> > Key Validation Class: org.apache.cassandra.db.marshal.UTF8Type >> > Default column value validator: org.apache.cassandra.db.marshal.UTF8Type >> > Columns sorted by: >> > org.apache.cassandra.db.marshal.CompositeType(org.apache.cassandra.db.marshal.LongType,org.apache.cassandra.db.marshal.UTF8Type) >> > >> > , except one is created from cql3: >> > >> > If it's just a printing issue it's really minor though >> > >> > on cql3: >> > CREATE TABLE timeline ( >> > ... user_id varchar, >> > ... tweet_id bigint, >> > ... author varchar, >> > ... body varchar, >> > ... PRIMARY KEY (user_id, tweet_id) >> > ... ); >> > INSERT INTO timeline (user_id, tweet_id, author, body) VALUES ('gmason', >> > 1765, 'phenry', 'Give me liberty or give me death'); >> > >> > >> > on CLI: >> > >> > create column family line with comparator = 'CompositeType(LongType, >> > UTF8Type)' AND key_validation_class=UTF8Type AND default_validation_class = >> > UTF8Type; >> > set line['dude']['1545:ok'] = '1'; >> > set line['dude']['1545:ok1'] = '11111'; >> > >> > list timeline; >> > RowKey: gmason >> > => (column=1765:author, value=phenry, timestamp=1349161331154000) >> > => (column=1765:body, value=Give me liberty or give me death, >> > timestamp=1349161331154001) >> > >> > list line; >> > RowKey: dude >> > => (column=1545:ok, value=1, timestamp=1349162658714000) >> > => (column=1545:ok1, value=11111, timestamp=1349162638658000) >> > >> > on cql3: >> > >> > select * from timeline; >> > user_id | tweet_id | author | body >> > ---------+----------+--------+---------------------------------- >> > gmason | 1765 | phenry | Give me liberty or give me death >> > >> > >> > select * from line; >> > key | column1 | column2 | value >> > ------+---------+---------+------- >> > dude | 1545 | ok | 1 >> > dude | 1545 | ok1 | 11111 >> > >> > >> > >> > ps: I have tried >> > >> > update column family line with comparator = 'CompositeType(LongType, >> > UTF8Type)' AND key_validation_class=UTF8Type AND column_metadata = [ >> > {column_name: tweet_id, validation_class: LongType} >> > {column_name: author, validation_class: UTF8Type} >> > {column_name: body, validation_class: UTF8Type} >> > ]; >> > for the CF line but it gives: >> > java.lang.RuntimeException: >> > org.apache.cassandra.db.marshal.MarshalException: unable to make long from >> > 'tweet_id' >> > >> >