Cassandra CQL - 将 system.local 表中的 release_version 列转换为 int [英] Cassandra CQL - Convert the release_version column in system.local table to an int
问题描述
我正在用 cql 编写一个查询,检查 Cassandra 的发布版本是否大于或等于 3.11.10.
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'
由于 release_version 是数据类型文本,这将不起作用,我无法找到获取此值的子字符串或将值转换为 int 的方法.
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.
我无法为此创建函数,因为我无法在系统表上创建函数.我也无法使用 Java/Python 等,必须在 cql 中完成.
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.
我也在 where 语句中尝试过 in 子句,但我似乎无法在没有错误的情况下在 in 中放入多个值:
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:
尚不支持非主键列 (release_version) 上的 IN 谓词
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?
推荐答案
不幸的是,没有办法在 CQL 中本地执行此操作.
Unfortunately, there isn't a way to do this natively in CQL.
如果您不能执行代码,那么至少您必须在 shell 脚本中执行.干杯!
If you can't execute code then at the very least you'd have to do it in a shell script. Cheers!
这篇关于Cassandra CQL - 将 system.local 表中的 release_version 列转换为 int的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!