You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Kishan Karunaratne (JIRA)" <ji...@apache.org> on 2015/02/12 00:46:12 UTC

[jira] [Comment Edited] (CASSANDRA-8779) Able to unintentionally nest tuples during insert

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

Kishan Karunaratne edited comment on CASSANDRA-8779 at 2/11/15 11:45 PM:
-------------------------------------------------------------------------

This is for the insert statement:
{noformat}
["request buffer", #<Ione::ByteBuffer: "\x03\x00\x00\x01\a\x00\x00\x00N\x00\x00\x00*INSERT INTO mytable (a, b) VALUES (1, (?))\x00\x01\x05\x00\x01\x00\x00\x00\x13\x00\x00\x00\x03foo\x00\x00\x00\b\x00\x00\x00\x00\x00\x00\x00{\x00\x00'\x10">]
{noformat}


was (Author: kishkaru):
This is for the insert statement:
{noformat}
["request buffer", #<Ione::ByteBuffer: "\x03\x00\x00\x03\a\x00\x00\x00s\x00\x00\x00lSELECT * FROM system.schema_columnfamilies WHERE keyspace_name = 'simplex' AND columnfamily_name = 'mytable'\x00\x01\x00\x03\x00\x00\x02\a\x00\x00\x00l\x00\x00\x00eSELECT * FROM system.schema_columns WHERE keyspace_name = 'simplex' AND columnfamily_name = 'mytable'\x00\x01\x00">]
{noformat}

> Able to unintentionally nest tuples during insert
> -------------------------------------------------
>
>                 Key: CASSANDRA-8779
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-8779
>             Project: Cassandra
>          Issue Type: Bug
>         Environment: Linux Mint 64-bit | ruby-driver 2.1 | java-driver 2.1 | C* 2.1.2
>            Reporter: Kishan Karunaratne
>            Assignee: Tyler Hobbs
>
> If I insert a tuple using an extra pair of ()'s, C* will let me do the insert, but (incorrectly) creates a nested tuple as the first tuple value. Upon doing a select statement, the result is jumbled and has weird binary in it (which I wasn't able to copy into here).
> Example using ruby-driver:
> {noformat}
> session.execute("CREATE TABLE mytable (a int PRIMARY KEY, b frozen<tuple<ascii, bigint, boolean>>)")
> complete = Cassandra::Tuple.new('foo', 123, true)
> session.execute("INSERT INTO mytable (a, b) VALUES (0, (?))", arguments: [complete])            # extra ()'s here
> result = session.execute("SELECT b FROM mytable WHERE a=0").first
> p result['b']
> {noformat}
> Output:
> {noformat}
> #<Cassandra::Tuple:0x97b328 (fo{, , )>
> {noformat}
> Bug also confirmed using java-driver. 
> Example using java-driver:
> {noformat}
> session.execute("CREATE TABLE mytable (a int PRIMARY KEY, b frozen<tuple<ascii, int, boolean>>)");
> TupleType t = TupleType.of(DataType.ascii(), DataType.cint(), DataType.cboolean());
> TupleValue complete = t.newValue("foo", 123, true);
> session.execute("INSERT INTO mytable (a, b) VALUES (0, (?))", complete); // extra ()'s here
> TupleValue r = session.execute("SELECT b FROM mytable WHERE a=0").one().getTupleValue("b");
> System.out.println(r);
> {noformat}
> Output:
> {noformat}
> ('foo{', null, null)
> {noformat}



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