时间:2019-03-07 标签:c#cube/multiDimensionalDataset
我正在解决一个问题,我需要使用 C# 处理内存中的多维数据。我的需求类似于 OLAP 多维数据集,但没有那么复杂。例如,我不需要计算或聚合或类似的东西。我基本上想使用多维键引用数据。例如:
var key = new Key();
key["Dim1"] = "DimValue1";
key["Dim2"] = "DimValue2";
key["Time"] = 1999;
DataSet[key] = 4.43434m;
它允许我迭代数据集的值或切片。你在 C# 中遇到过这样的库吗?
I'm working on a problem where i need to process multi dimensional data in memory using C#. My requirement resemble OLAP cubes but are not as complex. for example i don't need calculations or aggregation or stuff like that. I basically would like to reference data using multidimensional keys. for example:
var key = new Key();
key["Dim1"] = "DimValue1";
key["Dim2"] = "DimValue2";
key["Time"] = 1999;
DataSet[key] = 4.43434m;
And it would allow me to iterate on the values or slices of the dataset. Have you come across such a library in C#?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这可能无法满足您的需求,但我发现处理多键数据集的一种简单方法是创建一个包含所有“键”字段和“值”键(根据您需要的数量)的对象,并且然后为每个键创建查找表达式。
例如:
将被“索引”并像这样检索:
This may not meet your need, but I've found a simple way to deal with multi-key datasets is to create an object which contains all your 'key' fields and 'value' keys (as many of each as you need) and then create Lookup expressions for each of your keys.
For example:
would be 'indexed' and retrieved like this:
您可以创建一个字典,其中键类型是您声明的结构。尽管您可以通过过滤来实现切片的自动迭代,但它不会为您提供切片的自动迭代。
You could create a dictionary where the key type is a struct that you declare. That doesn't give you automatic iteration of slices, although you could achieve it by filtering.
我认为像 MongoDB 和 Redis 这样的键/值存储很接近我的需要。不过我不是100%确定。由于我不关心持久性,因此像 Redis 这样的内存故事更合适。
I think a key/value store like MongoDB and Redis is close to what I need. However I'm not 100% sure. Since I don't care about persistence, in memory story like Redis is more suitable.