如何在Map <String,float>上编写Aggregate函数以根据键值计算MIN,MAX和AVG

时间:2019-12-19 11:45:42

标签: java cassandra

我在cassandra中具有MAP类型的元素cloumn

elements = [{"a":10,"b":12,"c":13,"d":14},{"a":2,"b":1,"c":5,"d":19},{"a":5,"b":4,"c":13,"d":4},{"a":140,"b":1,"c":4,"d":14}]

我想用Java编写一个聚合函数,该函数可以找到Map Keys的最小最大值,结果将是这样。

[{a "min": 2, "max": 140},{b "min": 1, "max": 5},{c "min": 4, "max": 13},{d "min": 4, "max": 19}]

我从未写过这些东西。需要帮助。

0 个答案:

没有答案