You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by sl...@apache.org on 2011/09/08 10:20:18 UTC

svn commit: r1166564 - in /cassandra/trunk: CHANGES.txt NEWS.txt doc/cql/CQL.textile src/java/org/apache/cassandra/cql/CreateColumnFamilyStatement.java test/system/test_cql.py

Author: slebresne
Date: Thu Sep  8 08:20:18 2011
New Revision: 1166564

URL: http://svn.apache.org/viewvc?rev=1166564&view=rev
Log:
Update CQL type names to match expected (SQL) behavior
patch by jbellis; reviewed by slebresne for CASSANDRA-3149

Modified:
    cassandra/trunk/CHANGES.txt
    cassandra/trunk/NEWS.txt
    cassandra/trunk/doc/cql/CQL.textile
    cassandra/trunk/src/java/org/apache/cassandra/cql/CreateColumnFamilyStatement.java
    cassandra/trunk/test/system/test_cql.py

Modified: cassandra/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/cassandra/trunk/CHANGES.txt?rev=1166564&r1=1166563&r2=1166564&view=diff
==============================================================================
--- cassandra/trunk/CHANGES.txt (original)
+++ cassandra/trunk/CHANGES.txt Thu Sep  8 08:20:18 2011
@@ -66,6 +66,7 @@
    (CASSANDRA-3148)
  * fix inconsistency of the CLI syntax when {} should be used instead of [{}]
    (CASSANDRA-3119)
+ * rename CQL type names to match expected SQL behavior (CASSANDRA-3149)
 
 0.8.5
  * fix NPE when encryption_options is unspecified (CASSANDRA-3007)

Modified: cassandra/trunk/NEWS.txt
URL: http://svn.apache.org/viewvc/cassandra/trunk/NEWS.txt?rev=1166564&r1=1166563&r2=1166564&view=diff
==============================================================================
--- cassandra/trunk/NEWS.txt (original)
+++ cassandra/trunk/NEWS.txt Thu Sep  8 08:20:18 2011
@@ -8,6 +8,8 @@ Upgrading
     - the compaction_thread_priority setting has been removed from 
       cassandra.yaml (use compaction_throughput_mb_per_sec to throttle
       compaction instead)
+    - CQL types bytea and date were renamed to blob and timestamp, respectively,
+      to conform with SQL norms
 
 Features
 --------
@@ -40,6 +42,10 @@ Features
       easier/possible to repair a full cluster without any work duplication by
       running this command on every node of the cluster.
 
+New data types
+--------------
+    - decimal
+
 Other
 -----
     - Hinted Handoff is substantially more robust, with the result that

Modified: cassandra/trunk/doc/cql/CQL.textile
URL: http://svn.apache.org/viewvc/cassandra/trunk/doc/cql/CQL.textile?rev=1166564&r1=1166563&r2=1166564&view=diff
==============================================================================
--- cassandra/trunk/doc/cql/CQL.textile (original)
+++ cassandra/trunk/doc/cql/CQL.textile Thu Sep  8 08:20:18 2011
@@ -265,15 +265,19 @@ CREATE ... (<KEY> <type> PRIMARY KEY, na
 It is possible to assign columns a type during column family creation.  Columns configured with a type are validated accordingly when a write occurs. Column types are specified as a parenthesized, comma-separated list of column term and type pairs.  The list of recognized types are:
 
 |_. type|_. description|
-|bytea|Arbitrary bytes (no validation)|
 |ascii|ASCII character string|
+|bigint|8-byte long|
+|blob|Arbitrary bytes (no validation)|
+|boolean|true or false|
+|counter|Counter column, (8-byte long)|
+|decimal|Variable-precision decimal|
+|double|8-byte floating point|
+|float|4-byte floating point|
 |text|UTF8 encoded string|
-|varchar|UTF8 encoded string|
+|timestamp|Date + Time, encoded as 8 bytes since epoch|
 |uuid|Type 1, or type 4 UUID|
+|varchar|UTF8 encoded string|
 |varint|Arbitrary-precision integer|
-|int|8-byte long (same as bigint)|
-|bigint|8-byte long|
-|counter|Counter column, (8-byte long)|
 
 _Note: In addition to the recognized types listed above, it is also possible to supply a string containing the name of a class (a sub-class of @AbstractType@), either fully qualified, or relative to the @org.apache.cassandra.db.marshal@ package._
 
@@ -380,8 +384,9 @@ Versioning of the CQL language adheres t
 h1. Changes
 
 pre. 
-Thu, 07 Sep 2011 09:01:00 -0500 - Jonathan Ellis
+Wed, 07 Sep 2011 09:01:00 -0500 - Jonathan Ellis
  * Updated version to 2.0; Documented row-based count()
+ * Updated list of supported data types
 
 Wed, 10 Aug 2011 11:22:00 -0500 - Eric Evans
  * Improved INSERT vs. UPDATE wording.

Modified: cassandra/trunk/src/java/org/apache/cassandra/cql/CreateColumnFamilyStatement.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/cql/CreateColumnFamilyStatement.java?rev=1166564&r1=1166563&r2=1166564&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/cql/CreateColumnFamilyStatement.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/cql/CreateColumnFamilyStatement.java Thu Sep  8 08:20:18 2011
@@ -63,20 +63,20 @@ public class CreateColumnFamilyStatement
     
     static
     {
-        comparators.put("bytea", "BytesType");
         comparators.put("ascii", "AsciiType");
-        comparators.put("text", "UTF8Type");
-        comparators.put("varchar", "UTF8Type");
-        comparators.put("varint", "IntegerType");
-        comparators.put("int", "LongType");
         comparators.put("bigint", "LongType");
-        comparators.put("uuid", "UUIDType");
-        comparators.put("counter", "CounterColumnType");
+        comparators.put("blob", "BytesType");
         comparators.put("boolean", "BooleanType");
-        comparators.put("date", "DateType");
-        comparators.put("float", "FloatType");
-        comparators.put("double", "DoubleType");
+        comparators.put("counter", "CounterColumnType");
         comparators.put("decimal", "DecimalType");
+        comparators.put("double", "DoubleType");
+        comparators.put("float", "FloatType");
+        // comparators.put("int", "LongType"); TODO add int -> Int32Type
+        comparators.put("text", "UTF8Type");
+        comparators.put("timestamp", "DateType");
+        comparators.put("uuid", "UUIDType");
+        comparators.put("varchar", "UTF8Type");
+        comparators.put("varint", "IntegerType");
 
         keywords.add(KW_COMPARATOR);
         keywords.add(KW_COMMENT);

Modified: cassandra/trunk/test/system/test_cql.py
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/system/test_cql.py?rev=1166564&r1=1166563&r2=1166564&view=diff
==============================================================================
--- cassandra/trunk/test/system/test_cql.py (original)
+++ cassandra/trunk/test/system/test_cql.py Thu Sep  8 08:20:18 2011
@@ -71,7 +71,7 @@ def load_sample(dbconn):
             WITH comparator = ascii AND default_validation = uuid;
     """)
     dbconn.execute("""
-        CREATE COLUMNFAMILY IndexedA (KEY text PRIMARY KEY, birthdate int)
+        CREATE COLUMNFAMILY IndexedA (KEY text PRIMARY KEY, birthdate bigint)
             WITH comparator = ascii AND default_validation = ascii;
     """)
     dbconn.execute("""
@@ -490,7 +490,7 @@ class TestCql(ThriftTester):
         assert_raises(cql.ProgrammingError, cursor.execute, "CREATE COLUMNFAMILY NewCf2")
 
         # column name should not match key alias
-        assert_raises(cql.ProgrammingError, cursor.execute, "CREATE COLUMNFAMILY NewCf2 (id 'utf8' primary key, id int)")
+        assert_raises(cql.ProgrammingError, cursor.execute, "CREATE COLUMNFAMILY NewCf2 (id 'utf8' primary key, id bigint)")
 
         # Too many primary keys
         assert_raises(cql.ProgrammingError,
@@ -544,7 +544,7 @@ class TestCql(ThriftTester):
         "creating column indexes"
         cursor = init()
         cursor.execute("USE Keyspace1")
-        cursor.execute("CREATE COLUMNFAMILY CreateIndex1 (KEY text PRIMARY KEY, items text, stuff int)")
+        cursor.execute("CREATE COLUMNFAMILY CreateIndex1 (KEY text PRIMARY KEY, items text, stuff bigint)")
         cursor.execute("CREATE INDEX namedIndex ON CreateIndex1 (items)")
         cursor.execute("CREATE INDEX ON CreateIndex1 (stuff)")