cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stefania (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CASSANDRA-13364) Cqlsh COPY fails importing Map<String,List<String>>, ParseError unhashable type list
Date Wed, 29 Mar 2017 03:35:42 GMT

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

Stefania commented on CASSANDRA-13364:
--------------------------------------

The problem is that we cannot parse maps into Python dictionaries because otherwise we couldn't
parse dictionaries with another dictionary as key. So we use sets of tuples for dictionaries.
This means that even values must be hashable and lists aren't. A trivial fix is to however
parse lists as tuples, rather than lists. The driver should accept tuples for list cql types.

This is a regression for 2.1 and so the fix should be applied to 2.1 too.

||2.1||2.2||3.0||3.11||trunk||
|[patch|https://github.com/stef1927/cassandra/tree/13364-cqlsh-2.1]|[patch|https://github.com/stef1927/cassandra/tree/13364-cqlsh-2.2]|[patch|https://github.com/stef1927/cassandra/tree/13364-cqlsh-3.0]|[patch|https://github.com/stef1927/cassandra/tree/13364-cqlsh-3.11]|[patch|https://github.com/stef1927/cassandra/tree/13364-cqlsh]|
|[dtest|http://cassci.datastax.com/view/Dev/view/stef1927/job/stef1927-13364-cqlsh-2.1-cqlsh-tests/]|[dtest|http://cassci.datastax.com/view/Dev/view/stef1927/job/stef1927-13364-cqlsh-2.2-cqlsh-tests/]|[dtest|http://cassci.datastax.com/view/Dev/view/stef1927/job/stef1927-13364-cqlsh-3.0-cqlsh-tests/]|[dtest|http://cassci.datastax.com/view/Dev/view/stef1927/job/stef1927-13364-cqlsh-3.11-cqlsh-tests/]|[dtest|http://cassci.datastax.com/view/Dev/view/stef1927/job/stef1927-13364-cqlsh-cqlsh-tests/]|

The patch applies cleanly to all branches.

Test is [here|https://github.com/riptano/cassandra-dtest/pull/1456].

> Cqlsh COPY fails importing Map<String,List<String>>, ParseError unhashable
type list
> ------------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-13364
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-13364
>             Project: Cassandra
>          Issue Type: Bug
>            Reporter: Nicolae N
>            Assignee: Stefania
>              Labels: cqlsh
>             Fix For: 2.1.x, 2.2.x, 3.0.x, 3.11.x
>
>
> When importing data with the _COPY_ command into a column family that has a _map<text,
frozen<list<text>>>_ field, I get a _unhashable type: 'list'_ error. Here is
how to reproduce:
> {code}
> CREATE TABLE table1 (
>     col1 int PRIMARY KEY,
>     col2map map<text, frozen<list<text>>>
> );
> insert into table1 (col1, col2map) values (1, {'key': ['value1']});
> cqlsh:ks> copy table1 to 'table1.csv';
> table1.csv file content:
> 1,{'key': ['value1']}
> cqlsh:ks> copy table1 from 'table1.csv';
> ...
> Failed to import 1 rows: ParseError - Failed to parse {'key': ['value1']} : unhashable
type: 'list',  given up without retries
> Failed to process 1 rows; failed rows written to kv_table1.err
> Processed: 1 rows; Rate:       2 rows/s; Avg. rate:       2 rows/s
> 1 rows imported from 1 files in 0.420 seconds (0 skipped).
> {code}
> But it works fine for Map<String, Set<String>>.
> {code}
> CREATE TABLE table2 (
>     col1 int PRIMARY KEY,
>     col2map map<text, frozen<set<text>>>
> );
> insert into table2 (col1, col2map) values (1, {'key': {'value1'}});
> cqlsh:ks> copy table2 to 'table2.csv';
> table2.csv file content:
> 1,{'key': {'value1'}}
> cqlsh:ks> copy table2 from 'table2.csv';
> Processed: 1 rows; Rate:       2 rows/s; Avg. rate:       2 rows/s
> 1 rows imported from 1 files in 0.417 seconds (0 skipped).
> {code}
> The exception seems to arrive in _convert_map_ function in _ImportConversion_ class inside
_copyutil.py_.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message