mirror of https://github.com/apache/cassandra
Update CQL type names to match expected (SQL) behavior
patch by jbellis; reviewed by slebresne for CASSANDRA-3149 git-svn-id: https://svn.apache.org/repos/asf/cassandra/trunk@1166564 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2f8b4b7e23
commit
1ee25ee594
|
|
@ -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)
|
||||
|
|
|
|||
6
NEWS.txt
6
NEWS.txt
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -265,15 +265,19 @@ CREATE ... (<KEY> <type> PRIMARY KEY, name1 type, name2 type) ...
|
|||
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|
|
||||
|text|UTF8 encoded string|
|
||||
|varchar|UTF8 encoded string|
|
||||
|uuid|Type 1, or type 4 UUID|
|
||||
|varint|Arbitrary-precision integer|
|
||||
|int|8-byte long (same as bigint)|
|
||||
|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|
|
||||
|timestamp|Date + Time, encoded as 8 bytes since epoch|
|
||||
|uuid|Type 1, or type 4 UUID|
|
||||
|varchar|UTF8 encoded string|
|
||||
|varint|Arbitrary-precision integer|
|
||||
|
||||
_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 to the "Semantic Versioning":http://semve
|
|||
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.
|
||||
|
|
|
|||
|
|
@ -63,20 +63,20 @@ public class CreateColumnFamilyStatement
|
|||
|
||||
static
|
||||
{
|
||||
comparators.put("bytea", "BytesType");
|
||||
comparators.put("ascii", "AsciiType");
|
||||
comparators.put("bigint", "LongType");
|
||||
comparators.put("blob", "BytesType");
|
||||
comparators.put("boolean", "BooleanType");
|
||||
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");
|
||||
comparators.put("int", "LongType");
|
||||
comparators.put("bigint", "LongType");
|
||||
comparators.put("uuid", "UUIDType");
|
||||
comparators.put("counter", "CounterColumnType");
|
||||
comparators.put("boolean", "BooleanType");
|
||||
comparators.put("date", "DateType");
|
||||
comparators.put("float", "FloatType");
|
||||
comparators.put("double", "DoubleType");
|
||||
comparators.put("decimal", "DecimalType");
|
||||
|
||||
keywords.add(KW_COMPARATOR);
|
||||
keywords.add(KW_COMMENT);
|
||||
|
|
|
|||
|
|
@ -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)")
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue