You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by jb...@apache.org on 2012/01/10 21:01:53 UTC

[1/4] git commit: note that using KEY instead of the defined key_alias has been removed

Updated Branches:
  refs/heads/cassandra-1.0 044eb1ede -> e2231a197
  refs/heads/trunk a3f2e9c3b -> d48a6c14f


note that using KEY instead of the defined key_alias has been removed


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/d48a6c14
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/d48a6c14
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/d48a6c14

Branch: refs/heads/trunk
Commit: d48a6c14f370dfe97eb4e45c567ea9d1923914c6
Parents: d371edf
Author: Jonathan Ellis <jb...@apache.org>
Authored: Tue Jan 10 12:56:23 2012 -0600
Committer: Jonathan Ellis <jb...@apache.org>
Committed: Tue Jan 10 12:56:23 2012 -0600

----------------------------------------------------------------------
 NEWS.txt                                           |    5 +++++
 src/java/org/apache/cassandra/cql/WhereClause.java |    4 +---
 2 files changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/d48a6c14/NEWS.txt
----------------------------------------------------------------------
diff --git a/NEWS.txt b/NEWS.txt
index 24039e6..868ff73 100644
--- a/NEWS.txt
+++ b/NEWS.txt
@@ -39,6 +39,11 @@ Upgrading
     - Hadoop input and output details are now separated.  If you were
       previously using methods such as getRpcPort you now need to use
       getInputRpcPort or getOutputRpcPort depending on the circumstance.
+    - CQL changes:
+      + Prior to 1.1, you could use KEY as the primary key name in some
+        select statements, even if the PK was actually given a different
+        name.  In 1.1+ you must use the defined PK name.
+        
 
 Features
 --------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/d48a6c14/src/java/org/apache/cassandra/cql/WhereClause.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql/WhereClause.java b/src/java/org/apache/cassandra/cql/WhereClause.java
index 13e27e9..0007c98 100644
--- a/src/java/org/apache/cassandra/cql/WhereClause.java
+++ b/src/java/org/apache/cassandra/cql/WhereClause.java
@@ -160,7 +160,7 @@ public class WhereClause
         for (Relation relation : clauseRelations)
         {
             String name = relation.getEntity().getText().toUpperCase();
-            if (name.equals(realKeyAlias) || name.equals("KEY"))
+            if (name.equals(realKeyAlias))
             {
                 if (keyAlias == null) // setting found key as an alias
                     keyAlias = name;
@@ -199,6 +199,4 @@ public class WhereClause
                              multiKey,
                              keyAlias);
     }
-    
-
 }


Re: [1/4] git commit: note that using KEY instead of the defined key_alias has been removed

Posted by Eric Evans <ee...@acunu.com>.
On Tue, Jan 10, 2012 at 3:03 PM, Jonathan Ellis <jb...@gmail.com> wrote:
> Those were grandfathered in back in the day by CFMetaData.getKeyName
> simply returning KEY in that case.
>
> So if you have no key_alias defined, or it was defined to KEY, nothing
> changes.  But if you did define PK to be something else, then you need
> to use that PK name in your queries.  (Which, again, was already the
> case except we missed range scans.)

I got it now, thanks; Sorry for the noise.

-- 
Eric Evans
Acunu | http://www.acunu.com | @acunu

Re: [1/4] git commit: note that using KEY instead of the defined key_alias has been removed

Posted by Jonathan Ellis <jb...@gmail.com>.
Those were grandfathered in back in the day by CFMetaData.getKeyName
simply returning KEY in that case.

So if you have no key_alias defined, or it was defined to KEY, nothing
changes.  But if you did define PK to be something else, then you need
to use that PK name in your queries.  (Which, again, was already the
case except we missed range scans.)

On Tue, Jan 10, 2012 at 2:58 PM, Eric Evans <ee...@acunu.com> wrote:
> On Tue, Jan 10, 2012 at 2:45 PM, Jonathan Ellis <jb...@gmail.com> wrote:
>> Pedantic answer: yes, hence the NEWS entry
>>
>> More accurate answer: we've fixed a bug that allowed nonsense queries
>>
>> Long answer: we started off requiring the C* row key, aka PRIMARY KEY
>> in CQL DDL, to be named "key."  We fixed that in 0.8.1, and required
>> that SELECT statements use the actual PK name in most situations.
>> However, we missed the range scan case (WHERE key > X), which
>> continued to allow "key" even when that was not the PK name.  The
>> breaking change then for 1.1 was to bring that in line with other
>> SELECT forms by requiring the actual PK name be used.
>
> How do users that created schemas before named keys fit in?  Or are
> you saying that we had already broken them?
>
>> On Tue, Jan 10, 2012 at 2:11 PM, Eric Evans <ee...@acunu.com> wrote:
>>> This is a breaking change, isn't it?  Are we breaking the language and
>>> updating the CQL major *again*?
>>>
>>>
>>> ---------- Forwarded message ----------
>>> From:  <jb...@apache.org>
>>> Date: Tue, Jan 10, 2012 at 2:01 PM
>>> Subject: [1/4] git commit: note that using KEY instead of the defined
>>> key_alias has been removed
>>> To: commits@cassandra.apache.org
>>>
>>>
>>> Updated Branches:
>>>  refs/heads/cassandra-1.0 044eb1ede -> e2231a197
>>>  refs/heads/trunk a3f2e9c3b -> d48a6c14f
>>>
>>>
>>> note that using KEY instead of the defined key_alias has been removed
>>>
>>>
>>> Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
>>> Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/d48a6c14
>>> Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/d48a6c14
>>> Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/d48a6c14
>>>
>>> Branch: refs/heads/trunk
>>> Commit: d48a6c14f370dfe97eb4e45c567ea9d1923914c6
>>> Parents: d371edf
>>> Author: Jonathan Ellis <jb...@apache.org>
>>> Authored: Tue Jan 10 12:56:23 2012 -0600
>>> Committer: Jonathan Ellis <jb...@apache.org>
>>> Committed: Tue Jan 10 12:56:23 2012 -0600
>>>
>>> ----------------------------------------------------------------------
>>>  NEWS.txt                                           |    5 +++++
>>>  src/java/org/apache/cassandra/cql/WhereClause.java |    4 +---
>>>  2 files changed, 6 insertions(+), 3 deletions(-)
>>> ----------------------------------------------------------------------
>>>
>>>
>>> http://git-wip-us.apache.org/repos/asf/cassandra/blob/d48a6c14/NEWS.txt
>>> ----------------------------------------------------------------------
>>> diff --git a/NEWS.txt b/NEWS.txt
>>> index 24039e6..868ff73 100644
>>> --- a/NEWS.txt
>>> +++ b/NEWS.txt
>>> @@ -39,6 +39,11 @@ Upgrading
>>>     - Hadoop input and output details are now separated.  If you were
>>>       previously using methods such as getRpcPort you now need to use
>>>       getInputRpcPort or getOutputRpcPort depending on the circumstance.
>>> +    - CQL changes:
>>> +      + Prior to 1.1, you could use KEY as the primary key name in some
>>> +        select statements, even if the PK was actually given a different
>>> +        name.  In 1.1+ you must use the defined PK name.
>>> +
>>>
>>>  Features
>>>  --------
>>>
>>> http://git-wip-us.apache.org/repos/asf/cassandra/blob/d48a6c14/src/java/org/apache/cassandra/cql/WhereClause.java
>>> ----------------------------------------------------------------------
>>> diff --git a/src/java/org/apache/cassandra/cql/WhereClause.java
>>> b/src/java/org/apache/cassandra/cql/WhereClause.java
>>> index 13e27e9..0007c98 100644
>>> --- a/src/java/org/apache/cassandra/cql/WhereClause.java
>>> +++ b/src/java/org/apache/cassandra/cql/WhereClause.java
>>> @@ -160,7 +160,7 @@ public class WhereClause
>>>         for (Relation relation : clauseRelations)
>>>         {
>>>             String name = relation.getEntity().getText().toUpperCase();
>>> -            if (name.equals(realKeyAlias) || name.equals("KEY"))
>>> +            if (name.equals(realKeyAlias))
>>>             {
>>>                 if (keyAlias == null) // setting found key as an alias
>>>                     keyAlias = name;
>>> @@ -199,6 +199,4 @@ public class WhereClause
>>>                              multiKey,
>>>                              keyAlias);
>>>     }
>>> -
>>> -
>>>  }
>>>
>>>
>>>
>>> --
>>> Eric Evans
>>> Acunu | http://www.acunu.com | @acunu
>>
>>
>>
>> --
>> Jonathan Ellis
>> Project Chair, Apache Cassandra
>> co-founder of DataStax, the source for professional Cassandra support
>> http://www.datastax.com
>
>
>
> --
> Eric Evans
> Acunu | http://www.acunu.com | @acunu



-- 
Jonathan Ellis
Project Chair, Apache Cassandra
co-founder of DataStax, the source for professional Cassandra support
http://www.datastax.com

Re: [1/4] git commit: note that using KEY instead of the defined key_alias has been removed

Posted by Eric Evans <ee...@acunu.com>.
On Tue, Jan 10, 2012 at 2:45 PM, Jonathan Ellis <jb...@gmail.com> wrote:
> Pedantic answer: yes, hence the NEWS entry
>
> More accurate answer: we've fixed a bug that allowed nonsense queries
>
> Long answer: we started off requiring the C* row key, aka PRIMARY KEY
> in CQL DDL, to be named "key."  We fixed that in 0.8.1, and required
> that SELECT statements use the actual PK name in most situations.
> However, we missed the range scan case (WHERE key > X), which
> continued to allow "key" even when that was not the PK name.  The
> breaking change then for 1.1 was to bring that in line with other
> SELECT forms by requiring the actual PK name be used.

How do users that created schemas before named keys fit in?  Or are
you saying that we had already broken them?

> On Tue, Jan 10, 2012 at 2:11 PM, Eric Evans <ee...@acunu.com> wrote:
>> This is a breaking change, isn't it?  Are we breaking the language and
>> updating the CQL major *again*?
>>
>>
>> ---------- Forwarded message ----------
>> From:  <jb...@apache.org>
>> Date: Tue, Jan 10, 2012 at 2:01 PM
>> Subject: [1/4] git commit: note that using KEY instead of the defined
>> key_alias has been removed
>> To: commits@cassandra.apache.org
>>
>>
>> Updated Branches:
>>  refs/heads/cassandra-1.0 044eb1ede -> e2231a197
>>  refs/heads/trunk a3f2e9c3b -> d48a6c14f
>>
>>
>> note that using KEY instead of the defined key_alias has been removed
>>
>>
>> Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
>> Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/d48a6c14
>> Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/d48a6c14
>> Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/d48a6c14
>>
>> Branch: refs/heads/trunk
>> Commit: d48a6c14f370dfe97eb4e45c567ea9d1923914c6
>> Parents: d371edf
>> Author: Jonathan Ellis <jb...@apache.org>
>> Authored: Tue Jan 10 12:56:23 2012 -0600
>> Committer: Jonathan Ellis <jb...@apache.org>
>> Committed: Tue Jan 10 12:56:23 2012 -0600
>>
>> ----------------------------------------------------------------------
>>  NEWS.txt                                           |    5 +++++
>>  src/java/org/apache/cassandra/cql/WhereClause.java |    4 +---
>>  2 files changed, 6 insertions(+), 3 deletions(-)
>> ----------------------------------------------------------------------
>>
>>
>> http://git-wip-us.apache.org/repos/asf/cassandra/blob/d48a6c14/NEWS.txt
>> ----------------------------------------------------------------------
>> diff --git a/NEWS.txt b/NEWS.txt
>> index 24039e6..868ff73 100644
>> --- a/NEWS.txt
>> +++ b/NEWS.txt
>> @@ -39,6 +39,11 @@ Upgrading
>>     - Hadoop input and output details are now separated.  If you were
>>       previously using methods such as getRpcPort you now need to use
>>       getInputRpcPort or getOutputRpcPort depending on the circumstance.
>> +    - CQL changes:
>> +      + Prior to 1.1, you could use KEY as the primary key name in some
>> +        select statements, even if the PK was actually given a different
>> +        name.  In 1.1+ you must use the defined PK name.
>> +
>>
>>  Features
>>  --------
>>
>> http://git-wip-us.apache.org/repos/asf/cassandra/blob/d48a6c14/src/java/org/apache/cassandra/cql/WhereClause.java
>> ----------------------------------------------------------------------
>> diff --git a/src/java/org/apache/cassandra/cql/WhereClause.java
>> b/src/java/org/apache/cassandra/cql/WhereClause.java
>> index 13e27e9..0007c98 100644
>> --- a/src/java/org/apache/cassandra/cql/WhereClause.java
>> +++ b/src/java/org/apache/cassandra/cql/WhereClause.java
>> @@ -160,7 +160,7 @@ public class WhereClause
>>         for (Relation relation : clauseRelations)
>>         {
>>             String name = relation.getEntity().getText().toUpperCase();
>> -            if (name.equals(realKeyAlias) || name.equals("KEY"))
>> +            if (name.equals(realKeyAlias))
>>             {
>>                 if (keyAlias == null) // setting found key as an alias
>>                     keyAlias = name;
>> @@ -199,6 +199,4 @@ public class WhereClause
>>                              multiKey,
>>                              keyAlias);
>>     }
>> -
>> -
>>  }
>>
>>
>>
>> --
>> Eric Evans
>> Acunu | http://www.acunu.com | @acunu
>
>
>
> --
> Jonathan Ellis
> Project Chair, Apache Cassandra
> co-founder of DataStax, the source for professional Cassandra support
> http://www.datastax.com



-- 
Eric Evans
Acunu | http://www.acunu.com | @acunu

Re: [1/4] git commit: note that using KEY instead of the defined key_alias has been removed

Posted by Jonathan Ellis <jb...@gmail.com>.
Pedantic answer: yes, hence the NEWS entry

More accurate answer: we've fixed a bug that allowed nonsense queries

Long answer: we started off requiring the C* row key, aka PRIMARY KEY
in CQL DDL, to be named "key."  We fixed that in 0.8.1, and required
that SELECT statements use the actual PK name in most situations.
However, we missed the range scan case (WHERE key > X), which
continued to allow "key" even when that was not the PK name.  The
breaking change then for 1.1 was to bring that in line with other
SELECT forms by requiring the actual PK name be used.

On Tue, Jan 10, 2012 at 2:11 PM, Eric Evans <ee...@acunu.com> wrote:
> This is a breaking change, isn't it?  Are we breaking the language and
> updating the CQL major *again*?
>
>
> ---------- Forwarded message ----------
> From:  <jb...@apache.org>
> Date: Tue, Jan 10, 2012 at 2:01 PM
> Subject: [1/4] git commit: note that using KEY instead of the defined
> key_alias has been removed
> To: commits@cassandra.apache.org
>
>
> Updated Branches:
>  refs/heads/cassandra-1.0 044eb1ede -> e2231a197
>  refs/heads/trunk a3f2e9c3b -> d48a6c14f
>
>
> note that using KEY instead of the defined key_alias has been removed
>
>
> Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
> Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/d48a6c14
> Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/d48a6c14
> Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/d48a6c14
>
> Branch: refs/heads/trunk
> Commit: d48a6c14f370dfe97eb4e45c567ea9d1923914c6
> Parents: d371edf
> Author: Jonathan Ellis <jb...@apache.org>
> Authored: Tue Jan 10 12:56:23 2012 -0600
> Committer: Jonathan Ellis <jb...@apache.org>
> Committed: Tue Jan 10 12:56:23 2012 -0600
>
> ----------------------------------------------------------------------
>  NEWS.txt                                           |    5 +++++
>  src/java/org/apache/cassandra/cql/WhereClause.java |    4 +---
>  2 files changed, 6 insertions(+), 3 deletions(-)
> ----------------------------------------------------------------------
>
>
> http://git-wip-us.apache.org/repos/asf/cassandra/blob/d48a6c14/NEWS.txt
> ----------------------------------------------------------------------
> diff --git a/NEWS.txt b/NEWS.txt
> index 24039e6..868ff73 100644
> --- a/NEWS.txt
> +++ b/NEWS.txt
> @@ -39,6 +39,11 @@ Upgrading
>     - Hadoop input and output details are now separated.  If you were
>       previously using methods such as getRpcPort you now need to use
>       getInputRpcPort or getOutputRpcPort depending on the circumstance.
> +    - CQL changes:
> +      + Prior to 1.1, you could use KEY as the primary key name in some
> +        select statements, even if the PK was actually given a different
> +        name.  In 1.1+ you must use the defined PK name.
> +
>
>  Features
>  --------
>
> http://git-wip-us.apache.org/repos/asf/cassandra/blob/d48a6c14/src/java/org/apache/cassandra/cql/WhereClause.java
> ----------------------------------------------------------------------
> diff --git a/src/java/org/apache/cassandra/cql/WhereClause.java
> b/src/java/org/apache/cassandra/cql/WhereClause.java
> index 13e27e9..0007c98 100644
> --- a/src/java/org/apache/cassandra/cql/WhereClause.java
> +++ b/src/java/org/apache/cassandra/cql/WhereClause.java
> @@ -160,7 +160,7 @@ public class WhereClause
>         for (Relation relation : clauseRelations)
>         {
>             String name = relation.getEntity().getText().toUpperCase();
> -            if (name.equals(realKeyAlias) || name.equals("KEY"))
> +            if (name.equals(realKeyAlias))
>             {
>                 if (keyAlias == null) // setting found key as an alias
>                     keyAlias = name;
> @@ -199,6 +199,4 @@ public class WhereClause
>                              multiKey,
>                              keyAlias);
>     }
> -
> -
>  }
>
>
>
> --
> Eric Evans
> Acunu | http://www.acunu.com | @acunu



-- 
Jonathan Ellis
Project Chair, Apache Cassandra
co-founder of DataStax, the source for professional Cassandra support
http://www.datastax.com

Fwd: [1/4] git commit: note that using KEY instead of the defined key_alias has been removed

Posted by Eric Evans <ee...@acunu.com>.
This is a breaking change, isn't it?  Are we breaking the language and
updating the CQL major *again*?


---------- Forwarded message ----------
From:  <jb...@apache.org>
Date: Tue, Jan 10, 2012 at 2:01 PM
Subject: [1/4] git commit: note that using KEY instead of the defined
key_alias has been removed
To: commits@cassandra.apache.org


Updated Branches:
 refs/heads/cassandra-1.0 044eb1ede -> e2231a197
 refs/heads/trunk a3f2e9c3b -> d48a6c14f


note that using KEY instead of the defined key_alias has been removed


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/d48a6c14
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/d48a6c14
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/d48a6c14

Branch: refs/heads/trunk
Commit: d48a6c14f370dfe97eb4e45c567ea9d1923914c6
Parents: d371edf
Author: Jonathan Ellis <jb...@apache.org>
Authored: Tue Jan 10 12:56:23 2012 -0600
Committer: Jonathan Ellis <jb...@apache.org>
Committed: Tue Jan 10 12:56:23 2012 -0600

----------------------------------------------------------------------
 NEWS.txt                                           |    5 +++++
 src/java/org/apache/cassandra/cql/WhereClause.java |    4 +---
 2 files changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/d48a6c14/NEWS.txt
----------------------------------------------------------------------
diff --git a/NEWS.txt b/NEWS.txt
index 24039e6..868ff73 100644
--- a/NEWS.txt
+++ b/NEWS.txt
@@ -39,6 +39,11 @@ Upgrading
    - Hadoop input and output details are now separated.  If you were
      previously using methods such as getRpcPort you now need to use
      getInputRpcPort or getOutputRpcPort depending on the circumstance.
+    - CQL changes:
+      + Prior to 1.1, you could use KEY as the primary key name in some
+        select statements, even if the PK was actually given a different
+        name.  In 1.1+ you must use the defined PK name.
+

 Features
 --------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/d48a6c14/src/java/org/apache/cassandra/cql/WhereClause.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql/WhereClause.java
b/src/java/org/apache/cassandra/cql/WhereClause.java
index 13e27e9..0007c98 100644
--- a/src/java/org/apache/cassandra/cql/WhereClause.java
+++ b/src/java/org/apache/cassandra/cql/WhereClause.java
@@ -160,7 +160,7 @@ public class WhereClause
        for (Relation relation : clauseRelations)
        {
            String name = relation.getEntity().getText().toUpperCase();
-            if (name.equals(realKeyAlias) || name.equals("KEY"))
+            if (name.equals(realKeyAlias))
            {
                if (keyAlias == null) // setting found key as an alias
                    keyAlias = name;
@@ -199,6 +199,4 @@ public class WhereClause
                             multiKey,
                             keyAlias);
    }
-
-
 }



-- 
Eric Evans
Acunu | http://www.acunu.com | @acunu