Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 8C4BD200BB4 for ; Tue, 1 Nov 2016 21:13:45 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 8AD6D160AF7; Tue, 1 Nov 2016 20:13:45 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id AA3C1160ADA for ; Tue, 1 Nov 2016 21:13:44 +0100 (CET) Received: (qmail 29607 invoked by uid 500); 1 Nov 2016 20:13:43 -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 29597 invoked by uid 99); 1 Nov 2016 20:13:43 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 01 Nov 2016 20:13:43 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id A870E18061A for ; Tue, 1 Nov 2016 20:13:42 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.88 X-Spam-Level: * X-Spam-Status: No, score=1.88 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=disabled Authentication-Results: spamd3-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id Pvalp_YIiTDT for ; Tue, 1 Nov 2016 20:13:40 +0000 (UTC) Received: from mail-lf0-f51.google.com (mail-lf0-f51.google.com [209.85.215.51]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 39F1C5F54F for ; Tue, 1 Nov 2016 20:13:40 +0000 (UTC) Received: by mail-lf0-f51.google.com with SMTP id c13so28129238lfg.0 for ; Tue, 01 Nov 2016 13:13:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=7jpVR8mvnwgRlzN9LaPd9+VL+yB7nDf9p0cTFRQJzFM=; b=P7Vj8379o+rexB4YGLJVJPK8VWtm+bpsZ2hvxdPLsxIVQewd4U4SN5GqyR10GRLzd1 cunOcTURQSGwJCtzqrXiYcMExK7r0p2Lv5VPpN5p9U9rbqnfx/b52gvXdJ7B++jNI7Qj KYQKDDSzy3Ti1uwCirhTRYInsYuE4kQDGcpA6PYskxFGO2VbQJ5DCmd9TwobxtnOAKjT ypkY/4FHh2A5KRmkBhHdnYj+6FJosdVraRkYe4YBUIv3qjarvLu4HVF3rpB0KM/fAqze BscLxPUkEeAp+9K9m/SUF1fUsdAvqkH9OWZcksBn/YZKOphJlJ0uHQl6JT7hRhyU1ywQ e9mQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=7jpVR8mvnwgRlzN9LaPd9+VL+yB7nDf9p0cTFRQJzFM=; b=am2fVizV4XlxGTT3Hmr4zVTb5jxYx36Bt5JB4Iie+krpTafwxfn2HkilCSfG266ASo 2AJkTKYiby/Ot0mzYRW+HuJ6iL9OmIwxUWRPWeILZWCGk72r143DSBv6ZuXkrYPNv/w0 tBDSfC5QLi3vDys3BfPTxJUDKkcx4MSC0JthKR8WEdYjaN0DIoYz6VJQ+GC1atli52EC acpuM4Y9DJM8s6vmFSzvDkJBggNiEyscNV7wzABV5++U8xev4LaDSxz5iGSfsn5tkkzY 8k5JAjaxKs04CucRCjWUDr1uWRgDm+f9oq3+J35XcPbLOOZpxNYZltDCnn+wcy9z9Wwg 5OKQ== X-Gm-Message-State: ABUngvdbNedKmBsv/UtNgXV//xbb02b3FSBO1aJfdTYvy2/luCnkpWhL8GKJugSwGTjIqWrHmw5qHuakwgasaQ== X-Received: by 10.25.157.5 with SMTP id g5mr21708501lfe.182.1478031218681; Tue, 01 Nov 2016 13:13:38 -0700 (PDT) MIME-Version: 1.0 Received: by 10.25.16.106 with HTTP; Tue, 1 Nov 2016 13:13:37 -0700 (PDT) In-Reply-To: References: From: Edward Capriolo Date: Tue, 1 Nov 2016 16:13:37 -0400 Message-ID: Subject: Re: Cannot mix counter and non counter columns in the same table To: "user@cassandra.apache.org" Content-Type: multipart/alternative; boundary=001a11407468c1ad39054042f5cb archived-at: Tue, 01 Nov 2016 20:13:45 -0000 --001a11407468c1ad39054042f5cb Content-Type: text/plain; charset=UTF-8 Here is a solution that I have leverage. Ignore the count of the value and use a multi-part column name as it's value. For example: create column family stuff ( rowkey string, column string, value string. counter_to_ignore long, primary key( rowkey, column, value)); On Tue, Nov 1, 2016 at 9:29 AM, Ali Akhtar wrote: > That's a terrible gotcha rule. > > On Tue, Nov 1, 2016 at 6:27 PM, Cody Yancey wrote: > >> In your table schema, you have KEYS and you have VALUES. Your KEYS are >> text, but they could be any non-counter type or compound thereof. KEYS >> obviously cannot ever be counters. >> >> Your VALUES, however, must be either all counters or all non-counters. >> The official example you posted conforms to this limitation. >> >> Thanks, >> Cody >> >> On Nov 1, 2016 7:16 AM, "Ali Akhtar" wrote: >> >>> I'm not referring to the primary key, just to other columns. >>> >>> My primary key is a text, and my table contains a mix of texts, ints, >>> and timestamps. >>> >>> If I try to change one of the ints to a counter and run the create table >>> query, I get the error ' Cannot mix counter and non counter columns in >>> the same table' >>> >>> >>> On Tue, Nov 1, 2016 at 6:11 PM, Cody Yancey wrote: >>> >>>> For counter tables, non-counter types are of course allowed in the >>>> primary key. Counters would be meaningless otherwise. >>>> >>>> Thanks, >>>> Cody >>>> >>>> On Nov 1, 2016 7:00 AM, "Ali Akhtar" wrote: >>>> >>>>> In the documentation for counters: >>>>> >>>>> https://docs.datastax.com/en/cql/3.1/cql/cql_using/use_counter_t.html >>>>> >>>>> The example table is created via: >>>>> >>>>> CREATE TABLE counterks.page_view_counts >>>>> (counter_value counter, >>>>> url_name varchar, >>>>> page_name varchar, >>>>> PRIMARY KEY (url_name, page_name) >>>>> ); >>>>> >>>>> Yet if I try to create a table with a mixture of texts, ints, >>>>> timestamps, and counters, i get the error ' Cannot mix counter and non >>>>> counter columns in the same table' >>>>> >>>>> Is that supposed to be allowed or not allowed, given that the official >>>>> example contains a mix of counters and non-counters? >>>>> >>>> >>> > --001a11407468c1ad39054042f5cb Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Here is a solution that I have leverage. Ignore = the count of the value and use a multi-part column name as it's value.<= br>
For example:

create column family stuff (rowkey string,
column string,
value string.
counter_to_ignore long,
primary key( rowkey, colu= mn, value));


<= br>
On Tue, Nov 1, 2016 at 9:29 AM, Ali Akhtar <ali.rac200@gmail.com> wrote:
That's a terrible= gotcha rule.

On Tue, Nov 1, 2016 at 6:27 PM, Cody Yancey <<= a href=3D"mailto:yancey@uber.com" target=3D"_blank">yancey@uber.com>= wrote:

In your tab= le schema, you have KEYS and you have VALUES. Your KEYS are text, but they = could be any non-counter type or compound thereof. KEYS obviously cannot ev= er be counters.

Your VALUES, however, must be either all counters or all non= -counters. The official example you posted conforms to this limitation.

Thanks,
Cody


On Nov 1, 2016 7:= 16 AM, "Ali Akhtar" <ali.rac200@gmail.com> wrote:
I'm not referring to = the primary key, just to other columns.

My primary key i= s a text, and my table contains a mix of texts, ints, and timestamps.
=

If I try to change one of the ints to a counter and run= the create table query, I get the error=C2=A0' Cannot mix counter and non counter columns in the same table'=

<= div class=3D"gmail_extra">
On Tue, Nov 1, 201= 6 at 6:11 PM, Cody Yancey <yancey@uber.com> wrote:

For counter tables, non-counter types= are of course allowed in the primary key. Counters would be meaningless ot= herwise.

Thanks,
Cody


On Nov 1, 2016 7:= 00 AM, "Ali Akhtar" <ali.rac200@gmail.com> wrote:
The example table is created via:

CREATE TABLE counterks.page_view_counts
=C2=A0 (counter_val= ue counter,
=C2=A0 url_name varchar,
=C2=A0 page_name v= archar,
=C2=A0 PRIMARY KEY (url_name, page_name)
);

Yet if I try to create a table with a mixture o= f texts, ints, timestamps, and counters, i get the error ' Cannot mix c= ounter and non counter columns in the same table'

<= div>Is that supposed to be allowed or not allowed, given that the official = example contains a mix of counters and non-counters?



--001a11407468c1ad39054042f5cb--