Repository: cassandra
Updated Branches:
refs/heads/cassandra-2.1 666bee612 -> 07c9fa2ca
refs/heads/cassandra-2.2 7713c821c -> 5f99629a3
refs/heads/cassandra-3.0 f050133f2 -> c9285d0e3
refs/heads/trunk f07a406e5 -> db7d07cfa
cqlsh COPY FROM fails with []{} chars in UDT/tuple fields/values
patch by Robert Stupp; reviewed by Stefania for CASSANDRA-11633
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/07c9fa2c
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/07c9fa2c
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/07c9fa2c
Branch: refs/heads/cassandra-2.1
Commit: 07c9fa2cac21e572312bcfb0c778db41541ea7e4
Parents: 666bee6
Author: Robert Stupp <[email protected]>
Authored: Mon Apr 25 10:16:28 2016 +0200
Committer: Robert Stupp <[email protected]>
Committed: Mon Apr 25 10:16:28 2016 +0200
----------------------------------------------------------------------
CHANGES.txt | 1 +
pylib/cqlshlib/copyutil.py | 17 +++++++++--------
2 files changed, 10 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/07c9fa2c/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 2a93e9a..53945d6 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
2.1.15
+ * cqlsh COPY FROM fails with []{} chars in UDT/tuple fields/values
(CASSANDRA-11633)
* clqsh: COPY FROM throws TypeError with Cython extensions enabled
(CASSANDRA-11574)
* cqlsh: COPY FROM ignores NULL values in conversion (CASSANDRA-11549)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/07c9fa2c/pylib/cqlshlib/copyutil.py
----------------------------------------------------------------------
diff --git a/pylib/cqlshlib/copyutil.py b/pylib/cqlshlib/copyutil.py
index 16bdf02..e12b72f 100644
--- a/pylib/cqlshlib/copyutil.py
+++ b/pylib/cqlshlib/copyutil.py
@@ -1734,15 +1734,16 @@ class ImportConversion(object):
level = 0
quote = False
for i, c in enumerate(val):
- if c == '{' or c == '[' or c == '(':
- level += 1
- elif c == '}' or c == ']' or c == ')':
- level -= 1
- elif c == '\'':
+ if c == '\'':
quote = not quote
- elif c == sep and level == 1 and not quote:
- ret.append(val[last:i])
- last = i + 1
+ elif not quote:
+ if c == '{' or c == '[' or c == '(':
+ level += 1
+ elif c == '}' or c == ']' or c == ')':
+ level -= 1
+ elif c == sep and level == 1:
+ ret.append(val[last:i])
+ last = i + 1
else:
if last < len(val) - 1:
ret.append(val[last:-1])