Nadav Har'El created CASSANDRA-21736:
----------------------------------------

             Summary: A list literal whose elements have different types is 
accepted, with a result type that doesn't match the data
                 Key: CASSANDRA-21736
                 URL: https://issues.apache.org/jira/browse/CASSANDRA-21736
             Project: Apache Cassandra
          Issue Type: Bug
            Reporter: Nadav Har'El


{{CREATE TABLE ks.t (pk int, ck int, t text, PRIMARY KEY (pk, ck));
INSERT INTO ks.t (pk, ck, t) VALUES (1, 1, 'one');
SELECT [(CAST(pk AS BIGINT), CAST(ck AS BIGINT)), (t, WRITETIME(t))] FROM 
ks.t;}}
The two list elements are tuples of different types, {{(bigint, bigint)}} and 
{{{}(text, bigint){}}}. Cassandra accepts the query, describes the result type 
as {{list<frozen<tuple<bigint, bigint>>>}} (the first element's type), but 
serializes the second element as {{{}(text, bigint){}}}. A driver decoding the 
result per the declared type fails: the Python driver raises "Failed decoding 
result column … Requested more than length of buffer" and marks the connection 
as defunct.

The query should be rejected, since all elements of a list must have the same 
type. TermSelectionTest.testSelectLiteral (since "Add support for arithmetic 
operators", 2016) asserts this query's result, but reads it inside Cassandra 
without serializing it, so it doesn't notice. Reproduced on 5.0 and trunk (6.0).



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to