cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stefa...@apache.org
Subject [05/10] cassandra git commit: Merge branch 'cassandra-2.1' into cassandra-2.2
Date Wed, 27 Apr 2016 01:12:20 GMT
Merge branch 'cassandra-2.1' into cassandra-2.2


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

Branch: refs/heads/cassandra-3.0
Commit: b6b2517700b058900ec15b0c61717f82308c9138
Parents: 2dbcb5d 72057c6
Author: Stefania Alborghetti <stefania.alborghetti@datastax.com>
Authored: Wed Apr 27 09:06:45 2016 +0800
Committer: Stefania Alborghetti <stefania.alborghetti@datastax.com>
Committed: Wed Apr 27 09:07:48 2016 +0800

----------------------------------------------------------------------
 CHANGES.txt                |  1 +
 pylib/cqlshlib/copyutil.py | 36 +++++++++++++++++++++++++++---------
 2 files changed, 28 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/b6b25177/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index b3dea85,5885a9a..bdabf29
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,10 -1,5 +1,11 @@@
 -2.1.15
 +2.2.7
 + * Add missing files to debian packages (CASSANDRA-11642)
 + * Avoid calling Iterables::concat in loops during ModificationStatement::getFunctions (CASSANDRA-11621)
 + * cqlsh: COPY FROM should use regular inserts for single statement batches and
 +          report errors correctly if workers processes crash on initialization (CASSANDRA-11474)
 + * Always close cluster with connection in CqlRecordWriter (CASSANDRA-11553)
 +Merged from 2.1:
+  * cqlsh COPY FROM fails for null values with non-prepared statements (CASSANDRA-11631)
   * Make cython optional in pylib/setup.py (CASSANDRA-11630)
   * Change order of directory searching for cassandra.in.sh to favor local one (CASSANDRA-11628)
   * cqlsh COPY FROM fails with []{} chars in UDT/tuple fields/values (CASSANDRA-11633)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/b6b25177/pylib/cqlshlib/copyutil.py
----------------------------------------------------------------------
diff --cc pylib/cqlshlib/copyutil.py
index e927ccc,d68812c..a7a6671
--- a/pylib/cqlshlib/copyutil.py
+++ b/pylib/cqlshlib/copyutil.py
@@@ -1657,7 -1633,8 +1657,8 @@@ class ImportConversion(object)
          self.decimal_sep = parent.decimal_sep
          self.thousands_sep = parent.thousands_sep
          self.boolean_styles = parent.boolean_styles
 -        self.time_format = parent.time_format
 +        self.date_time_format = parent.date_time_format.timestamp_format
+         self.debug = parent.debug
  
          self.table_meta = table_meta
          self.primary_key_indexes = [self.columns.index(col.name) for col in self.table_meta.primary_key]
@@@ -1706,10 -1683,23 +1707,19 @@@
                  return CqlRuleSet.dequote_value(v)
  
          def convert(t, v):
-             return converters.get(t.typename, convert_unknown)(unprotect(v), ct=t)
+             v = unprotect(v)
+             if v == self.nullval:
+                 return self.get_null_val()
+             return converters.get(t.typename, convert_unknown)(v, ct=t)
+ 
+         def convert_mandatory(t, v):
+             v = unprotect(v)
+             if v == self.nullval:
+                 raise ParseError('Empty values are not allowed')
+             return converters.get(t.typename, convert_unknown)(v, ct=t)
  
          def convert_blob(v, **_):
 -            try:
 -                return bytearray.fromhex(v[2:])
 -            except TypeError:
 -                # Work-around for Python 2.6 bug
 -                return bytearray.fromhex(unicode(v[2:]))
 +            return bytearray.fromhex(v[2:])
  
          def convert_text(v, **_):
              return v
@@@ -1897,10 -1890,15 +1910,15 @@@
              if row[i] == self.nullval:
                  raise ParseError(self.get_null_primary_key_message(i))
  
-         try:
-             return [conv(val) if val != self.nullval else None for conv, val in zip(converters,
row)]
-         except Exception, e:
-             raise ParseError(e.message)
+         def convert(c, v):
+             try:
+                 return c(v) if v != self.nullval else self.get_null_val()
+             except Exception, e:
+                 if self.debug:
+                     traceback.print_exc()
 -                raise ParseError("Failed to parse %s : %s" % (val, str(e)))
++                raise ParseError("Failed to parse %s : %s" % (val, e.message))
+ 
+         return [convert(conv, val) for conv, val in zip(converters, row)]
  
      def get_null_primary_key_message(self, idx):
          message = "Cannot insert null value for primary key column '%s'." % (self.columns[idx],)


Mime
View raw message