cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stefa...@apache.org
Subject [02/15] cassandra git commit: cqlsh copy-from: encode column names to avoid primary key parsing errors
Date Thu, 22 Dec 2016 03:34:35 GMT
cqlsh copy-from: encode column names to avoid primary key parsing errors

patch by Stefania Alborghetti; reviewed by Benjamin Lerer for CASSANDRA-12909


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

Branch: refs/heads/cassandra-3.0
Commit: f4fd0928e6bc56600b7fd4d2469353c8f9d9da7d
Parents: 6bce8b0
Author: Stefania Alborghetti <stefania.alborghetti@datastax.com>
Authored: Mon Nov 14 09:19:58 2016 +0800
Committer: Stefania Alborghetti <stefania.alborghetti@datastax.com>
Committed: Thu Dec 22 11:17:39 2016 +0800

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


http://git-wip-us.apache.org/repos/asf/cassandra/blob/f4fd0928/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 1bed875..8a7ae42 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 2.2.9
+ * cqlsh copy-from: encode column names to avoid primary key parsing errors (CASSANDRA-12909)
  * Temporarily fix bug that creates commit log when running offline tools (CASSANDRA-8616)
  * Reduce granuality of OpOrder.Group during index build (CASSANDRA-12796)
  * Test bind parameters and unset parameters in InsertUpdateIfConditionTest (CASSANDRA-12980)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f4fd0928/pylib/cqlshlib/copyutil.py
----------------------------------------------------------------------
diff --git a/pylib/cqlshlib/copyutil.py b/pylib/cqlshlib/copyutil.py
index 4bc76e9..d22f2fe 100644
--- a/pylib/cqlshlib/copyutil.py
+++ b/pylib/cqlshlib/copyutil.py
@@ -1759,9 +1759,10 @@ class ImportConversion(object):
         # these functions are used for non-prepared statements to protect values with quotes
if required
         self.protectors = [self._get_protector(t) for t in self.coltypes]
 
-    def _get_protector(self, t):
+    @staticmethod
+    def _get_protector(t):
         if t in ('ascii', 'text', 'timestamp', 'date', 'time', 'inet'):
-            return lambda v: unicode(protect_value(v), self.encoding)
+            return lambda v: protect_value(v)
         else:
             return lambda v: v
 
@@ -2136,7 +2137,7 @@ class ImportProcess(ChildProcess):
         ChildProcess.__init__(self, params=params, target=self.run)
 
         self.skip_columns = params['skip_columns']
-        self.valid_columns = params['valid_columns']
+        self.valid_columns = [c.encode(self.encoding) for c in params['valid_columns']]
         self.skip_column_indexes = [i for i, c in enumerate(self.columns) if c in self.skip_columns]
 
         options = params['options']


Mime
View raw message