Search code examples
cassandracqlcqlsh

Cassandra CQL - Convert the release_version column in system.local table to an int


I am writing a query in cql that checks if the release version of Cassandra is greater than or equal to 3.11.10.

select * from system.local where release_version >= '3.11.10'

As the release_version is data type text this will not work and I cannot find a way to get a substring of this value or get a way to cast the value to an int.

I am unable to create a function for this as I cannot create a function on system tables. I am also unable to use Java/Python etc it has to be done in cql.

I have also tried in clause in where statement but I cannot seem to put in more than one value in the in without an error:

IN predicates on non-primary-key columns (release_version) is not yet supported

Would anyone know of a way to this or a workaround on how to get this to execute?


Solution

  • Unfortunately, there isn't a way to do this natively in CQL.

    If you can't execute code then at the very least you'd have to do it in a shell script. Cheers!