cqlsh: COPY FROM ignores NULL values in conversion

patch by Stefania Alborghetti; reviewed by Paulo Motta for CASSANDRA-11549


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

Branch: refs/heads/cassandra-3.0
Commit: c8914c0725f190df6e522179157850ebc855fdcb
Parents: 4389c9c
Author: Stefania Alborghetti <stefania.alborghe...@datastax.com>
Authored: Tue Apr 12 10:12:18 2016 +0800
Committer: Stefania Alborghetti <stefania.alborghe...@datastax.com>
Committed: Thu Apr 21 10:10:37 2016 +0800

----------------------------------------------------------------------
 CHANGES.txt                | 3 +++
 pylib/cqlshlib/copyutil.py | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/c8914c07/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 4a91a58..73780de 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,3 +1,6 @@
+2.1.15
+ * cqlsh: COPY FROM ignores NULL values in conversion (CASSANDRA-11549)
+
 2.1.14
  * (cqlsh) Fix potential COPY deadlock when parent process is terminating child
    processes (CASSANDRA-11505)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/c8914c07/pylib/cqlshlib/copyutil.py
----------------------------------------------------------------------
diff --git a/pylib/cqlshlib/copyutil.py b/pylib/cqlshlib/copyutil.py
index 12239d8..b6e0cff 100644
--- a/pylib/cqlshlib/copyutil.py
+++ b/pylib/cqlshlib/copyutil.py
@@ -1877,7 +1877,7 @@ class ImportConversion(object):
                 raise ParseError(self.get_null_primary_key_message(i))
 
         try:
-            return [conv(val) for conv, val in zip(converters, row)]
+            return [conv(val) if val != self.nullval else None for conv, val 
in zip(converters, row)]
         except Exception, e:
             raise ParseError(str(e))
 

Reply via email to