Johnny Miller created CASSANDRA-21719:
-----------------------------------------

             Summary: ANN query responses fail to serialize when the table has 
static columns outside the selection
                 Key: CASSANDRA-21719
                 URL: https://issues.apache.org/jira/browse/CASSANDRA-21719
             Project: Apache Cassandra
          Issue Type: Bug
          Components: Feature/SAI
            Reporter: Johnny Miller


On a replica serving an ANN query, StorageAttachedIndexSearcher wraps the top-k 
results in InMemoryUnfilteredPartitionIterator 
(StorageAttachedIndexSearcher.java line 149 on trunk). That iterator reports 
its columns as command.metadata().regularAndStaticColumns() instead of the 
columns the command actually fetched (InMemoryUnfilteredPartitionIterator.java 
line 115, InMemoryPartitionIterator.java line 107, same on cassandra-5.0). The 
response serializer builds its header from iterator.columns() 
(UnfilteredRowIteratorSerializer.java lines 101 to 104), and 
SerializationHeader.serializeForMessaging requires those columns to be a subset 
of what the command fetched. When the table has a static column the query did 
not select, that check fails and the read errors with 
IllegalStateException("... is not a subset of ...") from Columns.java line 618. 
For example, SELECT s1 with an ANN ORDER BY on a table that also has a static 
column s2.

The DataStax fork fixed this by returning the base iterator's columns, 
datastax/cassandra@ddbb38014c (their CNDB-14997). PartitionInfo.java here is 
byte for byte the fork's pre-fix version. Their regression test covers 
fork-only features (generic ORDER BY, BM25) so a port would need a trimmed 
test. I could not find an equivalent fix or an existing ticket here.

Verified on cassandra-5.0 and trunk.

Happy to port it the same way as CASSANDRA-21615 if wanted.



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