IN queries broken for literals of collections of UUID

Description

I’m migrating from version 3 to 4.17 of the Java client

I figured out all the migration steps, but there’s a last issue with literals of collections of uuids.

This code fails:

Update update = QueryBuilder.update(NOTIFICATION_TABLE) .usingTtl(DEFAULT_TTL) .setColumn(READ, literal(setReadTo)) .whereColumn(ACCOUNT_ID).isEqualTo(literal(accountId)) .whereColumn(PROJECT_ID).isEqualTo(literal(projectId)) .whereColumn(NOTIFICATION_ID).in(literal(batchIds)); session.execute(update.build());

where batchIds is a List<UUID>

With the exception:

com.datastax.oss.driver.api.core.servererrors.InvalidQueryException: Invalid list literal for id of type timeuuid

If I look at the generated CQL then I see that the UUIDs are surrounded with [], which is not correct afaik.

UPDATE notification USING TTL 5184000 SET read=true WHERE account_id=bad247b0-0886-4115-b0ec-fb4b3e366de3 AND project_id=9afdce32-a1a3-40ee-bbda-6c16aaaedd06 AND id IN ([da1c3790-3cba-11ee-b8e4-d156665ded88,da197870-3cba-11ee-b8e4-d156665ded88])

I can however make a raw query part without those brackets:

String update = QueryBuilder.update(NOTIFICATION_TABLE) .usingTtl(DEFAULT_TTL) .setColumn(READ, literal(setReadTo)) .whereColumn(ACCOUNT_ID).isEqualTo(literal(accountId)) .whereColumn(PROJECT_ID).isEqualTo(literal(projectId)) .whereRaw(NOTIFICATION_ID + " IN (" + String.join(",", batchIds.stream().map(UUID::toString).toList())) + ")"; session.execute(update);

And then the query succeeds. However, to update this across our entire application and use Strings everywhere instead of the query objects would involve a lot of refactoring.

Am I doing something wrong here or is this a bug?

Environment

None

Pull Requests

None

Activity

Show:

Details

Assignee

Reporter

Reproduced in

Affects versions

Priority

Created August 17, 2023 at 5:02 AM
Updated August 17, 2023 at 5:02 AM