【问题标题】:How to use like operator in cassandra database?如何在 cassandra 数据库中使用 like 运算符?
【发布时间】:2019-04-06 01:05:49
【问题描述】:

我在我的应用程序中使用 cassandra 数据库 cassandra:2.2.3,我应该使用 like 运算符来获取所有以“A%”开头的名称。

CREATE CUSTOM INDEX  empnames_idx ON d.emp (ename)
USING 'org.apache.cassandra.index.sasi.SASIIndex';

在我运行以下查询时创建索引后:

select * from d.emp where ename like 'A%';

<Error from server: code=2000 [Syntax error in CQL query] message="line 1:49 no viable alternative at input 'LIKE' (...* from d.emp where ename like .....)"

【问题讨论】:

  • Cassandra 不支持关键字 LIKE stackoverflow.com/questions/9905795/…
  • SASI 索引尚未准备好用于生产。
  • 您使用的是哪个版本的 cassandra?没有 6.0.2 这样的东西。
  • 现在有一个 LIKE 关键字,这是一个非常古老的答案@Yamini
  • @ChrisLohfink - 将其更改为 2.2.3 版本。

标签: cassandra


【解决方案1】:

直到 3.4+ 才支持它,但应该升级到 3.11.latest。您可能还想配置您的索引,这里有一个很好的演练:http://www.doanduyhai.com/blog/?p=2058

【讨论】:

  • 感谢您的链接。
猜你喜欢
  • 2017-01-14
  • 2015-12-13
  • 2016-11-03
  • 2011-07-08
  • 1970-01-01
  • 1970-01-01
  • 2021-02-21
  • 1970-01-01
  • 2021-03-01
相关资源
最近更新 更多