You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Jonathan Ellis (JIRA)" <ji...@apache.org> on 2011/03/31 20:14:05 UTC

[jira] [Created] (CASSANDRA-2409) Add INSERT support to CQL

Add INSERT support to CQL
-------------------------

                 Key: CASSANDRA-2409
                 URL: https://issues.apache.org/jira/browse/CASSANDRA-2409
             Project: Cassandra
          Issue Type: Bug
          Components: API
            Reporter: Jonathan Ellis
             Fix For: 0.8


There are two reasons to support INSERT:

- It helps new users feel comfortable (everyone's first statement will be to try to INSERT something, we should make that a positive experience instead of slapping them)
- Even though it is synonymous with update it is still useful in your code to have both to help communicate intent, similar to choosing good variable names

The only downside is explaining how INSERT isn't a "true" insert because it doesn't error out if the row already exists -- but we already have to explain that same concept for UPDATE; the cognitive load is extremely minor.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (CASSANDRA-2409) Add INSERT support to CQL

Posted by "Pavel Yaskevich (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CASSANDRA-2409?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Pavel Yaskevich updated CASSANDRA-2409:
---------------------------------------

    Attachment:     (was: CASSANDRA-2409.patch)

> Add INSERT support to CQL
> -------------------------
>
>                 Key: CASSANDRA-2409
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-2409
>             Project: Cassandra
>          Issue Type: Bug
>          Components: API
>            Reporter: Jonathan Ellis
>            Assignee: Pavel Yaskevich
>             Fix For: 0.8
>
>
> There are two reasons to support INSERT:
> - It helps new users feel comfortable (everyone's first statement will be to try to INSERT something, we should make that a positive experience instead of slapping them)
> - Even though it is synonymous with update it is still useful in your code to have both to help communicate intent, similar to choosing good variable names
> The only downside is explaining how INSERT isn't a "true" insert because it doesn't error out if the row already exists -- but we already have to explain that same concept for UPDATE; the cognitive load is extremely minor.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (CASSANDRA-2409) Add INSERT support to CQL

Posted by "Pavel Yaskevich (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CASSANDRA-2409?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Pavel Yaskevich updated CASSANDRA-2409:
---------------------------------------

    Attachment: CASSANDRA-2409.patch

> Add INSERT support to CQL
> -------------------------
>
>                 Key: CASSANDRA-2409
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-2409
>             Project: Cassandra
>          Issue Type: Bug
>          Components: API
>            Reporter: Jonathan Ellis
>            Assignee: Pavel Yaskevich
>             Fix For: 0.8
>
>         Attachments: CASSANDRA-2409.patch
>
>
> There are two reasons to support INSERT:
> - It helps new users feel comfortable (everyone's first statement will be to try to INSERT something, we should make that a positive experience instead of slapping them)
> - Even though it is synonymous with update it is still useful in your code to have both to help communicate intent, similar to choosing good variable names
> The only downside is explaining how INSERT isn't a "true" insert because it doesn't error out if the row already exists -- but we already have to explain that same concept for UPDATE; the cognitive load is extremely minor.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (CASSANDRA-2409) Add INSERT support to CQL

Posted by "Eric Evans (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CASSANDRA-2409?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13015523#comment-13015523 ] 

Eric Evans commented on CASSANDRA-2409:
---------------------------------------

Attached is an updated version of the patch that refactors things a bit.  The biggest problem here is that we need to raise Thrift exceptions.

Also included is some minimal system tests.

> Add INSERT support to CQL
> -------------------------
>
>                 Key: CASSANDRA-2409
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-2409
>             Project: Cassandra
>          Issue Type: Bug
>          Components: API
>            Reporter: Jonathan Ellis
>            Assignee: Pavel Yaskevich
>             Fix For: 0.8
>
>         Attachments: CASSANDRA-2409.patch, v1-0001-CASSANDRA-2409-CQL-INSERT-implementation.txt
>
>
> There are two reasons to support INSERT:
> - It helps new users feel comfortable (everyone's first statement will be to try to INSERT something, we should make that a positive experience instead of slapping them)
> - Even though it is synonymous with update it is still useful in your code to have both to help communicate intent, similar to choosing good variable names
> The only downside is explaining how INSERT isn't a "true" insert because it doesn't error out if the row already exists -- but we already have to explain that same concept for UPDATE; the cognitive load is extremely minor.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (CASSANDRA-2409) Add INSERT support to CQL

Posted by "Pavel Yaskevich (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CASSANDRA-2409?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13015567#comment-13015567 ] 

Pavel Yaskevich commented on CASSANDRA-2409:
--------------------------------------------

Oh, yeah, I've seen it, thats why I wrote you to change exception... I misunderstood your previous comment and I thought that there are still problems with exceptions left...

+1 on your patch.

> Add INSERT support to CQL
> -------------------------
>
>                 Key: CASSANDRA-2409
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-2409
>             Project: Cassandra
>          Issue Type: Bug
>          Components: API
>            Reporter: Jonathan Ellis
>            Assignee: Pavel Yaskevich
>             Fix For: 0.8
>
>         Attachments: CASSANDRA-2409.patch, v1-0001-CASSANDRA-2409-CQL-INSERT-implementation.txt
>
>
> There are two reasons to support INSERT:
> - It helps new users feel comfortable (everyone's first statement will be to try to INSERT something, we should make that a positive experience instead of slapping them)
> - Even though it is synonymous with update it is still useful in your code to have both to help communicate intent, similar to choosing good variable names
> The only downside is explaining how INSERT isn't a "true" insert because it doesn't error out if the row already exists -- but we already have to explain that same concept for UPDATE; the cognitive load is extremely minor.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (CASSANDRA-2409) Add INSERT support to CQL

Posted by "Pavel Yaskevich (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CASSANDRA-2409?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13015547#comment-13015547 ] 

Pavel Yaskevich commented on CASSANDRA-2409:
--------------------------------------------

Can you please explane a part about exceptions, what should be done?

> Add INSERT support to CQL
> -------------------------
>
>                 Key: CASSANDRA-2409
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-2409
>             Project: Cassandra
>          Issue Type: Bug
>          Components: API
>            Reporter: Jonathan Ellis
>            Assignee: Pavel Yaskevich
>             Fix For: 0.8
>
>         Attachments: CASSANDRA-2409.patch, v1-0001-CASSANDRA-2409-CQL-INSERT-implementation.txt
>
>
> There are two reasons to support INSERT:
> - It helps new users feel comfortable (everyone's first statement will be to try to INSERT something, we should make that a positive experience instead of slapping them)
> - Even though it is synonymous with update it is still useful in your code to have both to help communicate intent, similar to choosing good variable names
> The only downside is explaining how INSERT isn't a "true" insert because it doesn't error out if the row already exists -- but we already have to explain that same concept for UPDATE; the cognitive load is extremely minor.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (CASSANDRA-2409) Add INSERT support to CQL

Posted by "Eric Evans (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CASSANDRA-2409?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13015065#comment-13015065 ] 

Eric Evans commented on CASSANDRA-2409:
---------------------------------------

Thanks Pavel, I'll have a look at it and get back to you.

> Add INSERT support to CQL
> -------------------------
>
>                 Key: CASSANDRA-2409
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-2409
>             Project: Cassandra
>          Issue Type: Bug
>          Components: API
>            Reporter: Jonathan Ellis
>            Assignee: Pavel Yaskevich
>             Fix For: 0.8
>
>         Attachments: CASSANDRA-2409.patch
>
>
> There are two reasons to support INSERT:
> - It helps new users feel comfortable (everyone's first statement will be to try to INSERT something, we should make that a positive experience instead of slapping them)
> - Even though it is synonymous with update it is still useful in your code to have both to help communicate intent, similar to choosing good variable names
> The only downside is explaining how INSERT isn't a "true" insert because it doesn't error out if the row already exists -- but we already have to explain that same concept for UPDATE; the cognitive load is extremely minor.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (CASSANDRA-2409) Add INSERT support to CQL

Posted by "Pavel Yaskevich (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CASSANDRA-2409?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Pavel Yaskevich updated CASSANDRA-2409:
---------------------------------------

    Attachment: CASSANDRA-2409.patch

Format:
{noformat}
INSERT INTO
    <CF>
    (KEY, <column>, <column>, ...)
VALUES
    (<key>, <value>, <value>, ...)
(USING
  CONSISTENCY <level>)?;
{noformat}

Consistency level is set to ONE by default

> Add INSERT support to CQL
> -------------------------
>
>                 Key: CASSANDRA-2409
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-2409
>             Project: Cassandra
>          Issue Type: Bug
>          Components: API
>            Reporter: Jonathan Ellis
>            Assignee: Pavel Yaskevich
>             Fix For: 0.8
>
>         Attachments: CASSANDRA-2409.patch
>
>
> There are two reasons to support INSERT:
> - It helps new users feel comfortable (everyone's first statement will be to try to INSERT something, we should make that a positive experience instead of slapping them)
> - Even though it is synonymous with update it is still useful in your code to have both to help communicate intent, similar to choosing good variable names
> The only downside is explaining how INSERT isn't a "true" insert because it doesn't error out if the row already exists -- but we already have to explain that same concept for UPDATE; the cognitive load is extremely minor.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (CASSANDRA-2409) Add INSERT support to CQL

Posted by "Pavel Yaskevich (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CASSANDRA-2409?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13015055#comment-13015055 ] 

Pavel Yaskevich commented on CASSANDRA-2409:
--------------------------------------------

Only thing for you, Eric, to change is exception message when column names size not equal to values size...

> Add INSERT support to CQL
> -------------------------
>
>                 Key: CASSANDRA-2409
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-2409
>             Project: Cassandra
>          Issue Type: Bug
>          Components: API
>            Reporter: Jonathan Ellis
>            Assignee: Pavel Yaskevich
>             Fix For: 0.8
>
>         Attachments: CASSANDRA-2409.patch
>
>
> There are two reasons to support INSERT:
> - It helps new users feel comfortable (everyone's first statement will be to try to INSERT something, we should make that a positive experience instead of slapping them)
> - Even though it is synonymous with update it is still useful in your code to have both to help communicate intent, similar to choosing good variable names
> The only downside is explaining how INSERT isn't a "true" insert because it doesn't error out if the row already exists -- but we already have to explain that same concept for UPDATE; the cognitive load is extremely minor.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (CASSANDRA-2409) Add INSERT support to CQL

Posted by "Jonathan Ellis (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CASSANDRA-2409?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13014904#comment-13014904 ] 

Jonathan Ellis commented on CASSANDRA-2409:
-------------------------------------------

Close.

{code}
INSERT INTO cf (KEY, foo, bar, baz) VALUES (fnord, 1, 20 300);
{code}


> Add INSERT support to CQL
> -------------------------
>
>                 Key: CASSANDRA-2409
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-2409
>             Project: Cassandra
>          Issue Type: Bug
>          Components: API
>            Reporter: Jonathan Ellis
>            Assignee: Pavel Yaskevich
>             Fix For: 0.8
>
>         Attachments: CASSANDRA-2409.patch
>
>
> There are two reasons to support INSERT:
> - It helps new users feel comfortable (everyone's first statement will be to try to INSERT something, we should make that a positive experience instead of slapping them)
> - Even though it is synonymous with update it is still useful in your code to have both to help communicate intent, similar to choosing good variable names
> The only downside is explaining how INSERT isn't a "true" insert because it doesn't error out if the row already exists -- but we already have to explain that same concept for UPDATE; the cognitive load is extremely minor.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (CASSANDRA-2409) Add INSERT support to CQL

Posted by "Eric Evans (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CASSANDRA-2409?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13014867#comment-13014867 ] 

Eric Evans commented on CASSANDRA-2409:
---------------------------------------

I don't think this what Jonathan is after, he's looking for the equivalent of SQL's {{INSERT}}. For example:

{code:style=SQL}
INSERT INTO cf (foo, bar, baz) VALUES (1, 20 300) WHERE KEY = fnord;
{code}

> Add INSERT support to CQL
> -------------------------
>
>                 Key: CASSANDRA-2409
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-2409
>             Project: Cassandra
>          Issue Type: Bug
>          Components: API
>            Reporter: Jonathan Ellis
>            Assignee: Pavel Yaskevich
>             Fix For: 0.8
>
>         Attachments: CASSANDRA-2409.patch
>
>
> There are two reasons to support INSERT:
> - It helps new users feel comfortable (everyone's first statement will be to try to INSERT something, we should make that a positive experience instead of slapping them)
> - Even though it is synonymous with update it is still useful in your code to have both to help communicate intent, similar to choosing good variable names
> The only downside is explaining how INSERT isn't a "true" insert because it doesn't error out if the row already exists -- but we already have to explain that same concept for UPDATE; the cognitive load is extremely minor.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (CASSANDRA-2409) Add INSERT support to CQL

Posted by "Eric Evans (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CASSANDRA-2409?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Eric Evans updated CASSANDRA-2409:
----------------------------------

    Attachment: v1-0001-CASSANDRA-2409-CQL-INSERT-implementation.txt

> Add INSERT support to CQL
> -------------------------
>
>                 Key: CASSANDRA-2409
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-2409
>             Project: Cassandra
>          Issue Type: Bug
>          Components: API
>            Reporter: Jonathan Ellis
>            Assignee: Pavel Yaskevich
>             Fix For: 0.8
>
>         Attachments: CASSANDRA-2409.patch, v1-0001-CASSANDRA-2409-CQL-INSERT-implementation.txt
>
>
> There are two reasons to support INSERT:
> - It helps new users feel comfortable (everyone's first statement will be to try to INSERT something, we should make that a positive experience instead of slapping them)
> - Even though it is synonymous with update it is still useful in your code to have both to help communicate intent, similar to choosing good variable names
> The only downside is explaining how INSERT isn't a "true" insert because it doesn't error out if the row already exists -- but we already have to explain that same concept for UPDATE; the cognitive load is extremely minor.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (CASSANDRA-2409) Add INSERT support to CQL

Posted by "Pavel Yaskevich (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CASSANDRA-2409?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13014139#comment-13014139 ] 

Pavel Yaskevich commented on CASSANDRA-2409:
--------------------------------------------

Maybe I have a solution which will satisfy both sides - we can just make INSERT as an alias for UPDATE, so no need to implement anything just a simple change in the grammar, what do you think? 

> Add INSERT support to CQL
> -------------------------
>
>                 Key: CASSANDRA-2409
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-2409
>             Project: Cassandra
>          Issue Type: Bug
>          Components: API
>            Reporter: Jonathan Ellis
>            Assignee: Pavel Yaskevich
>             Fix For: 0.8
>
>
> There are two reasons to support INSERT:
> - It helps new users feel comfortable (everyone's first statement will be to try to INSERT something, we should make that a positive experience instead of slapping them)
> - Even though it is synonymous with update it is still useful in your code to have both to help communicate intent, similar to choosing good variable names
> The only downside is explaining how INSERT isn't a "true" insert because it doesn't error out if the row already exists -- but we already have to explain that same concept for UPDATE; the cognitive load is extremely minor.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (CASSANDRA-2409) Add INSERT support to CQL

Posted by "Eric Evans (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CASSANDRA-2409?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13015562#comment-13015562 ] 

Eric Evans commented on CASSANDRA-2409:
---------------------------------------

If you raise a RuntimeException from the lexer or parser, it will not be propagated down to the client (it's swallowed and turned into an internal server error).

If you look at the revised patch, I moved the size equality test and conversion to Map into {{UpdateStatement.getColumns()}} where an {{InvalidRequestException}} can be raised (everything that calls {{getColumns()}} already throws {{InvalidRequestException}}. 

> Add INSERT support to CQL
> -------------------------
>
>                 Key: CASSANDRA-2409
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-2409
>             Project: Cassandra
>          Issue Type: Bug
>          Components: API
>            Reporter: Jonathan Ellis
>            Assignee: Pavel Yaskevich
>             Fix For: 0.8
>
>         Attachments: CASSANDRA-2409.patch, v1-0001-CASSANDRA-2409-CQL-INSERT-implementation.txt
>
>
> There are two reasons to support INSERT:
> - It helps new users feel comfortable (everyone's first statement will be to try to INSERT something, we should make that a positive experience instead of slapping them)
> - Even though it is synonymous with update it is still useful in your code to have both to help communicate intent, similar to choosing good variable names
> The only downside is explaining how INSERT isn't a "true" insert because it doesn't error out if the row already exists -- but we already have to explain that same concept for UPDATE; the cognitive load is extremely minor.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (CASSANDRA-2409) Add INSERT support to CQL

Posted by "Eric Evans (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CASSANDRA-2409?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13014136#comment-13014136 ] 

Eric Evans commented on CASSANDRA-2409:
---------------------------------------

I don't think this is a good idea. {{UPDATE}} already has semantics that are going to be a surprise to folks coming from SQL. Implementing {{INSERT}} to have identical semantics is going to be (IMO) more surprising still, not less.

But, I don't want to get wrapped up in a protracted debate about it, so I'll leave this as "-0", and let you guys carry-on as you see fit.

P.S. Please don't wait too long, the freeze is looming.

> Add INSERT support to CQL
> -------------------------
>
>                 Key: CASSANDRA-2409
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-2409
>             Project: Cassandra
>          Issue Type: Bug
>          Components: API
>            Reporter: Jonathan Ellis
>            Assignee: Pavel Yaskevich
>             Fix For: 0.8
>
>
> There are two reasons to support INSERT:
> - It helps new users feel comfortable (everyone's first statement will be to try to INSERT something, we should make that a positive experience instead of slapping them)
> - Even though it is synonymous with update it is still useful in your code to have both to help communicate intent, similar to choosing good variable names
> The only downside is explaining how INSERT isn't a "true" insert because it doesn't error out if the row already exists -- but we already have to explain that same concept for UPDATE; the cognitive load is extremely minor.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Assigned] (CASSANDRA-2409) Add INSERT support to CQL

Posted by "Jonathan Ellis (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CASSANDRA-2409?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jonathan Ellis reassigned CASSANDRA-2409:
-----------------------------------------

    Assignee: Pavel Yaskevich

> Add INSERT support to CQL
> -------------------------
>
>                 Key: CASSANDRA-2409
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-2409
>             Project: Cassandra
>          Issue Type: Bug
>          Components: API
>            Reporter: Jonathan Ellis
>            Assignee: Pavel Yaskevich
>             Fix For: 0.8
>
>
> There are two reasons to support INSERT:
> - It helps new users feel comfortable (everyone's first statement will be to try to INSERT something, we should make that a positive experience instead of slapping them)
> - Even though it is synonymous with update it is still useful in your code to have both to help communicate intent, similar to choosing good variable names
> The only downside is explaining how INSERT isn't a "true" insert because it doesn't error out if the row already exists -- but we already have to explain that same concept for UPDATE; the cognitive load is extremely minor.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira