Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cassandra/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Cassandra 卡桑德拉-语法异常:行。。。select语句中的输入没有可行的替代方案_Cassandra_Cql - Fatal编程技术网

Cassandra 卡桑德拉-语法异常:行。。。select语句中的输入没有可行的替代方案

Cassandra 卡桑德拉-语法异常:行。。。select语句中的输入没有可行的替代方案,cassandra,cql,Cassandra,Cql,我试图使用下面的查询从cassandra数据库中选择数据,但失败了- SELECT id from keyspace.table where code=123 and toTimestamp(now()) >= some_date; Error- SyntaxException: line 1:103 no viable alternative at input '(' (...table where code=123 and [toTimestamp](...) 似乎是toTimes

我试图使用下面的查询从cassandra数据库中选择数据,但失败了-

SELECT id from keyspace.table where code=123 and toTimestamp(now()) >= some_date;

Error- SyntaxException: line 1:103 no viable alternative at input '(' (...table where code=123 and [toTimestamp](...)
似乎是toTimestamp(now())导致了问题。 有人能提出什么问题和解决方案吗?
谢谢。

您不能在WHERE语句中使用函数。因此,唯一的解决方法是获取应用程序中的当前时间,并将其传递给查询。此请求被跟踪为


但实际上,您的查询应该对某个列设置条件,而不是对计算值设置条件

请将您的表架构添加到问题中。实际上,它是通过如下方式交换日期条件来工作的-从keyspace.table中选择id,其中code=123和一些日期实际上,它是通过如下方式交换日期条件来工作的-从keyspace.table中选择id,其中code=123和一些日期@Yogesh,在提到吉拉之前,这是行不通的implemented@AlexOtt我想,
some_date
是他的列名。很抱歉,在我试图进行一般查询时,上面的查询造成了混乱。这是原始查询,它在交换所述条件后工作-从my_keyspace.vod_originator_sid_map中选择originator_id,其中有效的_start_date@Yogesh是的,您可能需要根据查询模式重建表。在这种情况下,你可能需要一个时间“桶”。看看我对这个问题的回答: