Return-Path: X-Original-To: apmail-cassandra-commits-archive@www.apache.org Delivered-To: apmail-cassandra-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 574A418932 for ; Wed, 27 Apr 2016 01:12:17 +0000 (UTC) Received: (qmail 90960 invoked by uid 500); 27 Apr 2016 01:12:16 -0000 Delivered-To: apmail-cassandra-commits-archive@cassandra.apache.org Received: (qmail 90893 invoked by uid 500); 27 Apr 2016 01:12:16 -0000 Mailing-List: contact commits-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cassandra.apache.org Delivered-To: mailing list commits@cassandra.apache.org Received: (qmail 90579 invoked by uid 99); 27 Apr 2016 01:12:16 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 27 Apr 2016 01:12:16 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 3402CDFC8F; Wed, 27 Apr 2016 01:12:16 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: stefania@apache.org To: commits@cassandra.apache.org Date: Wed, 27 Apr 2016 01:12:22 -0000 Message-Id: <7133cdea78924ecab854cfab97ec3c1f@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [07/10] cassandra git commit: Merge branch 'cassandra-2.1' into cassandra-2.2 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/trunk Commit: b6b2517700b058900ec15b0c61717f82308c9138 Parents: 2dbcb5d 72057c6 Author: Stefania Alborghetti Authored: Wed Apr 27 09:06:45 2016 +0800 Committer: Stefania Alborghetti 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],)