如何读取出区分大小写卡桑德拉数据 [英] How to read cassandra data with out case sensitive
问题描述
我需要从与出区分大小写卡桑德拉获取数据。请帮我。
I need to get the data from cassandra with out case sensitive. Please help me.
推荐答案
有在卡桑德拉不区分大小写的概念。所有的数据都存储为字节[]
,所以它甚至不是一个字符串。
There is no case-sensitivity concept in Cassandra. All the data is stored as byte[]
, so it's not even a String.
您可以创建一个自定义比较器(看到API ),其将字节[]
为String而忽略如此。
You can make a custom comparator (see the API) which transforms byte[]
to String and disregards case.
另一件事要做的仅仅是获取数据并将其转换在客户端上。
The other thing to do is just get the data and transform it on the client side.
其实,你的问题是什么是你的目标还不是很清楚,所以我不能透露更多的细节。
Actually, your question is quite unclear as of what is your goal, so I can't give more details.
更新:运行,从数据库获取所有记录并更新它们,设置为小写的一次性工作。然后继续小写插入一切。
Update: Run a one-time job that fetches all records from the db and updates them, setting to lower-case. Then continue inserting everything with lowercase.
这篇关于如何读取出区分大小写卡桑德拉数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!