用户在Cassandra中定义的数据类型

时间:2022-03-23 15:53:02

I’ve a query regarding data modelling in Cassandra, would appreciate some suggestions here.

我对Cassandra中的数据建模有一个疑问,请在此处提出一些建议。

We’re trying to build a multi-tenant application where we expect data structure to be defined by the users. A user may define a data source, number of fields, their data types, ordering etc. and then upload data based on this structure. How can we design such an application on top of Cassandra since it doesn’t support a list of mixed data types. The current collection types are Map (same types)/Set/List (same type). Moreover, is it possible to query data based on the user defined entities?

我们正在尝试构建一个多租户应用程序,我们希望用户可以定义数据结构。用户可以定义数据源,字段数,它们的数据类型,排序等,然后基于该结构上载数据。我们如何在Cassandra之上设计这样的应用程序,因为它不支持混合数据类型列表。当前集合类型是Map(相同类型)/ Set / List(相同类型)。此外,是否可以根据用户定义的实体查询数据?

Presently, we're thinking of maintaining a single Map and convert all the values into blob before storing. It doesn't definitely allow to query (only with CONTAINS clause), but helps to structure the problem. Any other potential methods?

目前,我们正在考虑维护单个Map并在存储之前将所有值转换为blob。它不一定允许查询(仅使用CONTAINS子句),但有助于构造问题。还有其他潜在方法吗?

1 个解决方案

#1


It is difficult to grasp exactly what you're trying to achieve but for what I can understand I think the map/set/list approach will not suffice you and you might hit performance problems. UDTs are similar in that regard. These are always loaded/read as a whole, like they were a blob.

很难准确掌握你想要实现的目标,但是我能理解的是,我认为地图/设置/列表方法不足以让你遇到性能问题。 UDT在这方面是类似的。它们总是作为一个整体加载/读取,就像它们是一个blob。

Read Collections for details.

阅读收藏集了解详情。

#1


It is difficult to grasp exactly what you're trying to achieve but for what I can understand I think the map/set/list approach will not suffice you and you might hit performance problems. UDTs are similar in that regard. These are always loaded/read as a whole, like they were a blob.

很难准确掌握你想要实现的目标,但是我能理解的是,我认为地图/设置/列表方法不足以让你遇到性能问题。 UDT在这方面是类似的。它们总是作为一个整体加载/读取,就像它们是一个blob。

Read Collections for details.

阅读收藏集了解详情。