Return-Path: Delivered-To: apmail-cassandra-commits-archive@www.apache.org Received: (qmail 81065 invoked from network); 21 Jan 2011 23:29:09 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 21 Jan 2011 23:29:09 -0000 Received: (qmail 31195 invoked by uid 500); 21 Jan 2011 23:29:09 -0000 Delivered-To: apmail-cassandra-commits-archive@cassandra.apache.org Received: (qmail 31116 invoked by uid 500); 21 Jan 2011 23:29:08 -0000 Mailing-List: contact commits-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 commits@cassandra.apache.org Received: (qmail 31103 invoked by uid 99); 21 Jan 2011 23:29:08 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 21 Jan 2011 23:29:08 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.22] (HELO thor.apache.org) (140.211.11.22) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 21 Jan 2011 23:29:05 +0000 Received: from thor (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id p0LNShcJ021644 for ; Fri, 21 Jan 2011 23:28:44 GMT Message-ID: <17225611.119231295652523816.JavaMail.jira@thor> Date: Fri, 21 Jan 2011 18:28:43 -0500 (EST) From: "Eric Evans (JIRA)" To: commits@cassandra.apache.org Subject: [jira] Updated: (CASSANDRA-2025) generalized way of expressing hierarchical values In-Reply-To: <1244121.114291295639864500.JavaMail.jira@thor> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/CASSANDRA-2025?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Eric Evans updated CASSANDRA-2025: ---------------------------------- Description: While hashing out {{CREATE KEYSPACE}}, it became obvious that we needed a syntax for expressing hierarchical values. Properties like {{replication_factor}} can be expressed simply using keyword arguments like ({{replication_factor = 3}}), but {{strategy_options}} is a map of strings. The solution I took in CASSANDRA-1709 was to dot-delimit "map name" and option key, so for example: {code:style=SQL} CREATE KEYSPACE keyspace WITH ... AND strategy_options.DC1 = "1" ... {code} This led me to wonder if this was a general enough approach for any future cases that might come up. One example might be compound/composite column names. Dot-delimiting is a bad choice here since it rules out ever introducing a float literal. One suggestion would be to colon-delimit, so for example: {code:style=SQL} CREATE KEYSPACE keyspace WITH ... AND strategy_options:DC1 = "1" ... {code} Or in the case of composite column names: {code:style=SQL} SELECT columnA:columnB,column1:column2 FROM Standard2 USING CONSISTENCY.QUORUM WHERE KEY = key; UPDATE Standard2 SET columnA:columnB = valueC, column1:column2 = value3 WHERE KEY = key; {code} As an aside, this also led me to the conclusion that {{CONSISTENCY.}} is probably a bad choice for consistency level specification. It mirrors the underlying enum for no good reason and should probably be changed to {{CONSISTENCY }} (i.e. omitting the separator). For example: {code:style=SQL} SELECT column FROM Standard2 USING CONSISTENCY QUORUM WHERE KEY = key; {code} Thoughts? *Edit: improved final example* *Edit: restore final example, create new one (gah).* was: While hashing out {{CREATE KEYSPACE}}, it became obvious that we needed a syntax for expressing hierarchical values. Properties like {{replication_factor}} can be expressed simply using keyword arguments like ({{replication_factor = 3}}), but {{strategy_options}} is a map of strings. The solution I took in CASSANDRA-1709 was to dot-delimit "map name" and option key, so for example: {code:style=SQL} CREATE KEYSPACE keyspace WITH ... AND strategy_options.DC1 = "1" ... {code} This led me to wonder if this was a general enough approach for any future cases that might come up. One example might be compound/composite column names. Dot-delimiting is a bad choice here since it rules out ever introducing a float literal. One suggestion would be to colon-delimit, so for example: {code:style=SQL} CREATE KEYSPACE keyspace WITH ... AND strategy_options:DC1 = "1" ... {code} As an aside, this also led me to the conclusion that {{CONSISTENCY.}} is probably a bad choice for consistency level specification. It mirrors the underlying enum for no good reason and should probably be changed to {{CONSISTENCY }} (i.e. omitting the separator). For example: {code:style=SQL} SELECT columnA:columnB,column1:column2 FROM Standard2 USING CONSISTENCY QUORUM WHERE KEY = key; UPDATE Standard2 SET columnA:columnB = valueC, column1:column2 = value3 WHERE KEY = key; {code} Thoughts? *Edit: improved final example* > generalized way of expressing hierarchical values > ------------------------------------------------- > > Key: CASSANDRA-2025 > URL: https://issues.apache.org/jira/browse/CASSANDRA-2025 > Project: Cassandra > Issue Type: Sub-task > Components: API > Reporter: Eric Evans > Assignee: Eric Evans > Priority: Minor > Fix For: 0.8 > > Original Estimate: 0h > Remaining Estimate: 0h > > While hashing out {{CREATE KEYSPACE}}, it became obvious that we needed a syntax for expressing hierarchical values. Properties like {{replication_factor}} can be expressed simply using keyword arguments like ({{replication_factor = 3}}), but {{strategy_options}} is a map of strings. > The solution I took in CASSANDRA-1709 was to dot-delimit "map name" and option key, so for example: > {code:style=SQL} > CREATE KEYSPACE keyspace WITH ... AND strategy_options.DC1 = "1" ... > {code} > This led me to wonder if this was a general enough approach for any future cases that might come up. One example might be compound/composite column names. Dot-delimiting is a bad choice here since it rules out ever introducing a float literal. > One suggestion would be to colon-delimit, so for example: > {code:style=SQL} > CREATE KEYSPACE keyspace WITH ... AND strategy_options:DC1 = "1" ... > {code} > Or in the case of composite column names: > {code:style=SQL} > SELECT columnA:columnB,column1:column2 FROM Standard2 USING CONSISTENCY.QUORUM WHERE KEY = key; > UPDATE Standard2 SET columnA:columnB = valueC, column1:column2 = value3 WHERE KEY = key; > {code} > As an aside, this also led me to the conclusion that {{CONSISTENCY.}} is probably a bad choice for consistency level specification. It mirrors the underlying enum for no good reason and should probably be changed to {{CONSISTENCY }} (i.e. omitting the separator). For example: > {code:style=SQL} > SELECT column FROM Standard2 USING CONSISTENCY QUORUM WHERE KEY = key; > {code} > Thoughts? > *Edit: improved final example* > *Edit: restore final example, create new one (gah).* -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.