You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by ty...@apache.org on 2014/08/19 21:55:20 UTC

[1/2] git commit: cqlsh: fix COPY FROM handling of null/empty PK values

Repository: cassandra
Updated Branches:
  refs/heads/cassandra-2.1 92325cc12 -> 3a03d4bd5


cqlsh: fix COPY FROM handling of null/empty PK values

Patch by Tyler Hobbs; reviewed by Aleksey Yeschenko for CASSANDRA-7792


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

Branch: refs/heads/cassandra-2.1
Commit: 94262c43908904303610c1243531a00167c03e0f
Parents: 853e772
Author: Tyler Hobbs <ty...@datastax.com>
Authored: Tue Aug 19 14:53:57 2014 -0500
Committer: Tyler Hobbs <ty...@datastax.com>
Committed: Tue Aug 19 14:53:57 2014 -0500

----------------------------------------------------------------------
 CHANGES.txt |  2 ++
 bin/cqlsh   | 12 +++++++++---
 2 files changed, 11 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/94262c43/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index ca58708..5113057 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,6 @@
 2.1.0
+ * (cqlsh) Fix COPY FROM handling of null/empty primary key
+   values (CASSANDRA-7792)
  * Fix ordering of static cells (CASSANDRA-7763)
 Merged from 2.0:
  * Fix PRSI handling of CQL3 row markers for row cleanup (CASSANDRA-7787)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/94262c43/bin/cqlsh
----------------------------------------------------------------------
diff --git a/bin/cqlsh b/bin/cqlsh
index ab1e215..4c90f2d 100755
--- a/bin/cqlsh
+++ b/bin/cqlsh
@@ -1344,7 +1344,7 @@ class Shell(cmd.Cmd):
 
     def do_import_row(self, columns, nullval, table_meta, row):
         rowmap = {}
-        clustering_key_columns = [col.name for col in table_meta.clustering_key]
+        primary_key_columns = [col.name for col in table_meta.primary_key]
         for name, value in zip(columns, row):
             type = table_meta.columns[name].data_type
             cqltype = table_meta.columns[name].typestring
@@ -1354,8 +1354,14 @@ class Shell(cmd.Cmd):
                     rowmap[name] = protect_value(value)
                 else:
                     rowmap[name] = value
-            elif name in clustering_key_columns and not type.empty_binary_ok:
-                rowmap[name] = 'blobAs%s(0x)' % cqltype.title()
+            elif name in primary_key_columns:
+                # By default, nullval is an empty string. See CASSANDRA-7792 for details.
+                message = "Cannot insert null value for primary key column '%s'." % (name,)
+                if nullval == '':
+                    message += " If you want to insert empty strings, consider using " \
+                               "the WITH NULL=<marker> option for COPY."
+                self.printerr(message)
+                return False
             else:
                 rowmap[name] = 'null'
         return self.do_import_insert(table_meta, rowmap)


[2/2] git commit: Merge branch 'cassandra-2.1.0' into cassandra-2.1

Posted by ty...@apache.org.
Merge branch 'cassandra-2.1.0' into cassandra-2.1


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

Branch: refs/heads/cassandra-2.1
Commit: 3a03d4bd55e0fbb6e18f7709eedd5148e0f18a68
Parents: 92325cc 94262c4
Author: Tyler Hobbs <ty...@datastax.com>
Authored: Tue Aug 19 14:55:04 2014 -0500
Committer: Tyler Hobbs <ty...@datastax.com>
Committed: Tue Aug 19 14:55:04 2014 -0500

----------------------------------------------------------------------
 CHANGES.txt |  2 ++
 bin/cqlsh   | 12 +++++++++---
 2 files changed, 11 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a03d4bd/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 0763738,5113057..d29a2db
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,38 -1,6 +1,40 @@@
 +2.1.1
 + * Support list index operations with conditions (CASSANDRA-7499)
 + * Add max live/tombstoned cells to nodetool cfstats output (CASSANDRA-7731)
 + * Validate IPv6 wildcard addresses properly (CASSANDRA-7680)
 + * (cqlsh) Error when tracing query (CASSANDRA-7613)
 + * Avoid IOOBE when building SyntaxError message snippet (CASSANDRA-7569)
 + * SSTableExport uses correct validator to create string representation of partition
 +   keys (CASSANDRA-7498)
 + * Avoid NPEs when receiving type changes for an unknown keyspace (CASSANDRA-7689)
 + * Add support for custom 2i validation (CASSANDRA-7575)
 + * Pig support for hadoop CqlInputFormat (CASSANDRA-6454)
 + * Add listen_interface and rpc_interface options (CASSANDRA-7417)
 + * Improve schema merge performance (CASSANDRA-7444)
 + * Adjust MT depth based on # of partition validating (CASSANDRA-5263)
 + * Optimise NativeCell comparisons (CASSANDRA-6755)
 + * Configurable client timeout for cqlsh (CASSANDRA-7516)
 + * Include snippet of CQL query near syntax error in messages (CASSANDRA-7111)
 +Merged from 2.0:
 + * Throw InvalidRequestException when queries contain relations on entire
 +   collection columns (CASSANDRA-7506)
 + * (cqlsh) enable CTRL-R history search with libedit (CASSANDRA-7577)
 + * (Hadoop) allow ACFRW to limit nodes to local DC (CASSANDRA-7252)
 + * (cqlsh) cqlsh should automatically disable tracing when selecting
 +   from system_traces (CASSANDRA-7641)
 + * (Hadoop) Add CqlOutputFormat (CASSANDRA-6927)
 + * Don't depend on cassandra config for nodetool ring (CASSANDRA-7508)
 + * (cqlsh) Fix failing cqlsh formatting tests (CASSANDRA-7703)
 + * Fix IncompatibleClassChangeError from hadoop2 (CASSANDRA-7229)
 + * Add 'nodetool sethintedhandoffthrottlekb' (CASSANDRA-7635)
 + * (cqlsh) Add tab-completion for CREATE/DROP USER IF [NOT] EXISTS (CASSANDRA-7611)
 + * Catch errors when the JVM pulls the rug out from GCInspector (CASSANDRA-5345)
 + * cqlsh fails when version number parts are not int (CASSANDRA-7524)
 +
 +
  2.1.0
+  * (cqlsh) Fix COPY FROM handling of null/empty primary key
+    values (CASSANDRA-7792)
   * Fix ordering of static cells (CASSANDRA-7763)
  Merged from 2.0:
   * Fix PRSI handling of CQL3 row markers for row cleanup (CASSANDRA-7787)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3a03d4bd/bin/cqlsh
----------------------------------------------------------------------