[
https://issues.apache.org/jira/browse/CASSANDRA-1705?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12932976#action_12932976
]
Eric Evans commented on CASSANDRA-1705:
---------------------------------------
> I have a question after viewing code:
>
> 1). Can you please explain to me why you do so if method is already declared
> to
> throw those exceptions (it breaks exception flow...)?
>
> {code}
> try
> {
> StorageProxy.mutate(rowMutations, consistency);
> }
> catch (org.apache.cassandra.thrift.UnavailableException e)
> {
> throw new UnavailableException();
> }
> catch (TimeoutException e)
> {
> throw new TimedOutException();
> }
> {code}
StorageProxy.mutate() throws Thrift's version of UnavailableException, and
java.util.concurrent.TimeoutException, but the Avro exception types need to be
propagated up.
> 2). Suggestion for grammar:
>
> {code}
> K_SET c1=term '=' v1=term { columns.put(c1, v1); } (',' cN=term '=' vN=term {
> columns.put(cN, vN); })*
> {code}
>
> Could be changed to use scope like this:
>
> {code}
> updateStatement returns [UpdateStatement expr]
> scope {
> Map<Term, Term> columns = new HashMap<Term, Term>();
> }
> : -//-
> K_SET (columnForUpdate)+
> -//-
> {
> -//-
> }
> ;
>
> columnForUpdate
> : key=term '=' value='term'
> {
> $updateStatement::columns.put($key, $value)
> }
> ;
> {code}
>
> What do you think?
Is this for aesthetics, or some other reason?
If it's just aesthetics, then for what it's worth, I've avoided breaking out
parts of a statement unless they were to be reused elsewhere. I've been doing
it this way because I thought it was more readable (particularly for people
unfamiliar with antlr) to see the entire statement composed in one place. But,
I realize that's probably entirely subjective and I'm open to being convinced
otherwise.
> CQL writes (aka UPDATE)
> -----------------------
>
> Key: CASSANDRA-1705
> URL: https://issues.apache.org/jira/browse/CASSANDRA-1705
> Project: Cassandra
> Issue Type: Sub-task
> Components: API
> Affects Versions: 0.8
> Reporter: Eric Evans
> Assignee: Eric Evans
> Priority: Minor
> Fix For: 0.8
>
> Attachments: CQL.html,
> v2-0001-CASSANDRA-1705.-doc-update-for-proposed-UPDATE.txt,
> v2-0002-conforming-single-statement-UPDATE-impl.txt,
> v2-0003-batched-UPDATEs.txt
>
> Original Estimate: 0h
> Remaining Estimate: 0h
>
> CQL specification and implementation for data manipulation.
> This corresponds to the following RPC methods:
> * insert()
> * batch_mutate() (writes, not deletes)
> The initial check-in to trunk/ uses a syntax that looks like:
> {code:SQL}
> UPDATE <CF> [USING CONSISTENCY.<LVL>] WITH ROW(<key>, COLUMN(<name>,
> <value>)[, COLUMN(...)])[ AND ROW(...)];
> {code}
> Where:
> * <CF> is the column family name.
> * Rows are a parenthesized expressions with comma separated arguments for a
> key and one or more columns.
> * Columns are a parenthesized expressions with comma separated arguments for
> the name and value (timestamp is inaccessible).
> What is still undone:
> * Complete test coverage
> And of course, all of this is still very much open to further discussion.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.