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

Tyler Hobbs commented on CASSANDRA-8779:
----------------------------------------

bq. TypeError: 'tuple' does not have the buffer interface

That's a bit of an obtuse error message, but basically the driver is expecting 
AsciiType (since it's the first item in the tuple, from Cassandra's 
perspective) and the driver encounters a TypeError when trying to write it as 
an AsciiType value.

My guess is that the Ruby and Java drivers aren't catching this type error and 
are writing out some bad binary.   Somehow that binary is passing validation in 
Cassandra.  Can you get a dump of the binary Query message that's being sent by 
the driver?

> 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)

Reply via email to