You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Stefania (JIRA)" <ji...@apache.org> on 2016/12/13 06:34:58 UTC

[jira] [Commented] (CASSANDRA-12959) copy from csv import wrong values with udt having set when fields are not specified in correct order in csv

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

Stefania commented on CASSANDRA-12959:
--------------------------------------

This is a regression of CASSANDRA-9302: if the udt fields are not in the correct order, it imports values incorrectly or it fails with a conversion error if the types are incompatible.

This is the patch for all branches starting with 2.1. Although this is not a critical bug I argue that it should be in 2.1 because it is a regression and it is safe to fix. Since the patch applies cleanly to all branches, I have launched CI only on 4 of the 6 eligible branches (I skipped 3.11 and 3.x):

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

The test to reproduce this problem is [here|https://github.com/riptano/cassandra-dtest/pull/1406].

[~pauloricardomg] or [~thobbs], would you be able to review?

> copy from csv import wrong values with udt having set when fields are not specified in correct order in csv
> -----------------------------------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-12959
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-12959
>             Project: Cassandra
>          Issue Type: Bug
>          Components: CQL
>            Reporter: Quentin Ambard
>            Assignee: Stefania
>
>  {quote}
> create KEYSPACE test WITH replication = \{ 'class': 'SimpleStrategy', 'replication_factor': 1\};
> CREATE TYPE test.my_udt (
>     first_field text,
>     second_field frozen<set<text>>
> );
> CREATE TABLE test.test ( key text, value my_udt, PRIMARY KEY (key));
> {quote}
> The following works as expected : 
> {quote}
> INSERT INTO test.test (key , value ) VALUES ( 'key1', \{second_field: \{'test1', 'test2'\}, first_field: 'first_field'\});
>  key  | value
> ------+----------------------------------------------------------------
>  key1 | \{first_field: 'first_field', second_field: \{'test1', 'test2'\}\}
> {quote}
> but when inserted using a .csv the result is wrong:
> {quote}"key1","\{second_field: \{'test1', 'test2'\}, first_field: 'first_field'\}"
> COPY test.test FROM '~/test.csv';
>  key  | value
> ------+----------------------------------------------------------------------
>  key1 | \{first_field: '\{''test1'', ''test2''\}', second_field: \{'irst_fiel'\}\}
> {quote}
> it works as expected if the keys are in order: 
> bq. "key1","\{first_field: 'first_field', second_field: \{'test1', 'test2'\}\}")



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