You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Jaroslav KamenĂ­k <ja...@kamenik.cz> on 2016/11/11 08:22:09 UTC

Problem with COPY FROM/TO and counters

Hi guys,

we are making a simple tool which allows us to transform table
via COPY TO -> drop table -> transform schema/data -> create table -> COPY
FROM.

It works well in most cases, but we have problem with loading of counter
columns, it fails with "ParseError - argument for 's' must be a string,
 given up without retries.".
It works well if the same column is defined as int.

Are we doing something wrong or encountered C* error?


Thanks,

Jaroslav



[/tmp]$ echo
"EVT:be3bd2d0-a68d-11e6-90d4-1b2a65b8a28a,f7ce3ac0-a66e-11e6-b58e-4e29450fd577,SA,2"
> data.csv
[/tmp]$ cqlsh
Connected to WOC at 127.0.0.1:9042.
[cqlsh 5.0.1 | Cassandra 3.10-SNAPSHOT | CQL spec 3.4.3 | Native protocol
v4]
Use HELP for help.
cqlsh> CREATE TABLE woc.table_test (
   ... object_id ascii,
   ... user_id timeuuid,
   ... counter_id ascii,
   ... count counter,
   ... PRIMARY KEY ((object_id, user_id), counter_id)
   ... );
cqlsh>quit;
[/tmp]$ cqlsh -e "copy woc.table_test(object_id, user_id, counter_id,
count) from 'data.csv';"
Using 7 child processes

Starting copy of woc.table_test with columns [object_id, user_id,
counter_id, count].
<stdin>:1:Failed to import 1 rows: ParseError - argument for 's' must be a
string,  given up without retries
<stdin>:1:Failed to process 1 rows; failed rows written to
import_woc_table_test.err
Processed: 1 rows; Rate:       1 rows/s; Avg. rate:       2 rows/s
1 rows imported from 1 files in 0.560 seconds (0 skipped).
[/tmp]$
[/tmp]$
[/tmp]$
[/tmp]$
[/tmp]$ cqlsh
Connected to WOC at 127.0.0.1:9042.
[cqlsh 5.0.1 | Cassandra 3.10-SNAPSHOT | CQL spec 3.4.3 | Native protocol
v4]
Use HELP for help.
cqlsh> drop table woc.table_test;
cqlsh>
cqlsh> CREATE TABLE woc.table_test (
   ... object_id ascii,
   ... user_id timeuuid,
   ... counter_id ascii,
   ... count int,
   ... PRIMARY KEY ((object_id, user_id), counter_id));
cqlsh>quit;
[/tmp]$ cqlsh -e "copy woc.table_test(object_id, user_id, counter_id,
count) from 'data.csv';"
Using 7 child processes

Starting copy of woc.table_test with columns [object_id, user_id,
counter_id, count].
Processed: 1 rows; Rate:       1 rows/s; Avg. rate:       2 rows/s
1 rows imported from 1 files in 0.652 seconds (0 skipped).
[/tmp]$





//////// data

echo
"EVT:be3bd2d0-a68d-11e6-90d4-1b2a65b8a28a,f7ce3ac0-a66e-11e6-b58e-4e29450fd577,SA,2"
> data.csv


//////// table definitions, first one is with counter column, second with
int column


CREATE TABLE woc.table_test (
object_id ascii,
user_id timeuuid,
counter_id ascii,
count counter,
PRIMARY KEY ((object_id, user_id), counter_id)
);

DROP TABLE woc.table_test;

CREATE TABLE woc.table_test (
object_id ascii,
user_id timeuuid,
counter_id ascii,
count int,
PRIMARY KEY ((object_id, user_id), counter_id)
);

Re: Problem with COPY FROM/TO and counters

Posted by Stefania Alborghetti <st...@datastax.com>.
Thanks for reporting this, I've opened CASSANDRA-12909
<https://issues.apache.org/jira/browse/CASSANDRA-12909> with all the
details.

You can apply the patch linked in that ticket if you want a quick
workaround, but the root cause is still not fully understood.

The reason why only counters are affected is that when there are counters,
we do not use prepared statements, it seems the problem only occurs with
non prepared statements.

On Fri, Nov 11, 2016 at 4:22 PM, Jaroslav KamenĂ­k <ja...@kamenik.cz>
wrote:

> Hi guys,
>
> we are making a simple tool which allows us to transform table
> via COPY TO -> drop table -> transform schema/data -> create table -> COPY
> FROM.
>
> It works well in most cases, but we have problem with loading of counter
> columns, it fails with "ParseError - argument for 's' must be a string,
>  given up without retries.".
> It works well if the same column is defined as int.
>
> Are we doing something wrong or encountered C* error?
>
>
> Thanks,
>
> Jaroslav
>
>
>
> [/tmp]$ echo "EVT:be3bd2d0-a68d-11e6-90d4-1b2a65b8a28a,f7ce3ac0-a66e-11e6-b58e-4e29450fd577,SA,2"
> > data.csv
> [/tmp]$ cqlsh
> Connected to WOC at 127.0.0.1:9042.
> [cqlsh 5.0.1 | Cassandra 3.10-SNAPSHOT | CQL spec 3.4.3 | Native protocol
> v4]
> Use HELP for help.
> cqlsh> CREATE TABLE woc.table_test (
>    ... object_id ascii,
>    ... user_id timeuuid,
>    ... counter_id ascii,
>    ... count counter,
>    ... PRIMARY KEY ((object_id, user_id), counter_id)
>    ... );
> cqlsh>quit;
> [/tmp]$ cqlsh -e "copy woc.table_test(object_id, user_id, counter_id,
> count) from 'data.csv';"
> Using 7 child processes
>
> Starting copy of woc.table_test with columns [object_id, user_id,
> counter_id, count].
> <stdin>:1:Failed to import 1 rows: ParseError - argument for 's' must be a
> string,  given up without retries
> <stdin>:1:Failed to process 1 rows; failed rows written to
> import_woc_table_test.err
> Processed: 1 rows; Rate:       1 rows/s; Avg. rate:       2 rows/s
> 1 rows imported from 1 files in 0.560 seconds (0 skipped).
> [/tmp]$
> [/tmp]$
> [/tmp]$
> [/tmp]$
> [/tmp]$ cqlsh
> Connected to WOC at 127.0.0.1:9042.
> [cqlsh 5.0.1 | Cassandra 3.10-SNAPSHOT | CQL spec 3.4.3 | Native protocol
> v4]
> Use HELP for help.
> cqlsh> drop table woc.table_test;
> cqlsh>
> cqlsh> CREATE TABLE woc.table_test (
>    ... object_id ascii,
>    ... user_id timeuuid,
>    ... counter_id ascii,
>    ... count int,
>    ... PRIMARY KEY ((object_id, user_id), counter_id));
> cqlsh>quit;
> [/tmp]$ cqlsh -e "copy woc.table_test(object_id, user_id, counter_id,
> count) from 'data.csv';"
> Using 7 child processes
>
> Starting copy of woc.table_test with columns [object_id, user_id,
> counter_id, count].
> Processed: 1 rows; Rate:       1 rows/s; Avg. rate:       2 rows/s
> 1 rows imported from 1 files in 0.652 seconds (0 skipped).
> [/tmp]$
>
>
>
>
>
> //////// data
>
> echo "EVT:be3bd2d0-a68d-11e6-90d4-1b2a65b8a28a,f7ce3ac0-a66e-11e6-b58e-4e29450fd577,SA,2"
> > data.csv
>
>
> //////// table definitions, first one is with counter column, second with
> int column
>
>
> CREATE TABLE woc.table_test (
> object_id ascii,
> user_id timeuuid,
> counter_id ascii,
> count counter,
> PRIMARY KEY ((object_id, user_id), counter_id)
> );
>
> DROP TABLE woc.table_test;
>
> CREATE TABLE woc.table_test (
> object_id ascii,
> user_id timeuuid,
> counter_id ascii,
> count int,
> PRIMARY KEY ((object_id, user_id), counter_id)
> );
>



-- 


Stefania Alborghetti

|+852 6114 9265| stefania.alborghetti@datastax.com