[ 
https://issues.apache.org/jira/browse/CASSANDRA-12909?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15672957#comment-15672957
 ] 

Stefania commented on CASSANDRA-12909:
--------------------------------------

What's happening is that when we [protect 
values|https://github.com/apache/cassandra/blob/trunk/pylib/cqlshlib/copyutil.py#L1822]
 for non-prepared statements, we convert strings to Unicode and neither our 
[converter|https://github.com/apache/cassandra/blob/trunk/pylib/cqlshlib/copyutil.py#L1867],
 nor the [python driver when using python version 
2|https://github.com/datastax/python-driver/blob/master/cassandra/cqltypes.py#L425],
 convert them back to ascii.

Then as we know, [python 2 won't pack unicode 
strings|https://bugs.python.org/issue10783], so they must be encoded first.

I've fixed it by introducing an ascii specific converter.  

||2.2||3.0||3.X||trunk||
|[patch|https://github.com/stef1927/cassandra/tree/12909-cqlsh-2.2]|[patch|https://github.com/stef1927/cassandra/tree/12909-cqlsh-3.0]|[patch|https://github.com/stef1927/cassandra/tree/12909-cqlsh-3.X]|[patch|https://github.com/stef1927/cassandra/tree/12909-cqlsh]|
|[tests|http://cassci.datastax.com/view/Dev/view/stef1927/job/stef1927-12909-cqlsh-2.2-cqlsh-tests/]|[tests|http://cassci.datastax.com/view/Dev/view/stef1927/job/stef1927-12909-cqlsh-3.0-cqlsh-tests/]|[tests|http://cassci.datastax.com/view/Dev/view/stef1927/job/stef1927-12909-cqlsh-3.X-cqlsh-tests/]|[tests|http://cassci.datastax.com/view/Dev/view/stef1927/job/stef1927-12909-cqlsh-cqlsh-tests/]|

The new test is [here|https://github.com/riptano/cassandra-dtest/pull/1393].

> cqlsh copy cannot parse strings when counters are present
> ---------------------------------------------------------
>
>                 Key: CASSANDRA-12909
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-12909
>             Project: Cassandra
>          Issue Type: Bug
>            Reporter: Stefania
>            Assignee: Stefania
>             Fix For: 2.2.x, 3.0.x, 3.x
>
>
> We get parse error {{Failed to import 1 rows: ParseError - argument for 's' 
> must be a string}} when using the following table and data:
> {code}
> CREATE TABLE ks.test (
>     object_id ascii,
>     user_id timeuuid,
>     counter_id ascii,
>     count counter,
>     PRIMARY KEY ((object_id, user_id), counter_id)
> )
> {code}
> {code}
> EVT:be3bd2d0-a68d-11e6-90d4-1b2a65b8a28a,f7ce3ac0-a66e-11e6-b58e-4e29450fd577,SA,2
> {code}
> The problem is this line 
> [here|https://github.com/apache/cassandra/blob/trunk/pylib/cqlshlib/copyutil.py#L2114],
>  strings are serialized as unicode rather than ordinary strings but only for 
> non-prepared statements (unsure why).



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to