Skip to content

CassandraFilterExpressionConverter bug with ExpressionType.IN with collections #3160

@soheilrahsaz

Description

@soheilrahsaz

When using a filter expression on a collection in CassandraVectorStore.similaritySearch like this
new Filter.Expression(Filter.ExpressionType.IN, new Filter.Key("currencies"), new Filter.Value(List.of("BTC")));

In CassandraFilterExpressionConverter, it will go through doListValue and then tries to encode each value using doValue, But in doValue method, it is trying to get the codec for the column itself, which is a list, and then fails to encode the string value in the list and throws exception:
java.lang.ClassCastException: class java.lang.String cannot be cast to class java.util.List (java.lang.String and java.util.List are in module java.base of loader 'bootstrap')

It seems that for collections, it should use the elementType of the dataType and not the dataType of the column itself. (CassandraFilterExpressionConverter line 124)

Image

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions