cqlsh COPY FROM fails with []{} chars in UDT/tuple fields/values

patch by Robert Stupp; reviewed by Stefania for CASSANDRA-11633
This commit is contained in:
Robert Stupp 2016-04-25 10:16:28 +02:00
parent 666bee6125
commit 07c9fa2cac
2 changed files with 10 additions and 8 deletions

View File

@ -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)

View File

@ -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])