MAX(),DISTINCT和Cassandra中的group by

编程入门 行业动态 更新时间:2024-10-27 08:37:31
本文介绍了MAX(),DISTINCT和Cassandra中的group by的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我试图重塑一个SQL数据库Cassandra,这样,我可以找到Cassandra等效的SQL查询。我使用CQL 3和Cassandra v1.2。我在cassandra中建模数据库设计,以便它支持order by子句和非规范化表来支持连接操作。然而,我在海上,当涉及到DISTINCT,SUM()和GROUPBY等价

I am trying to remodel a SQL database Cassandra such that, I can find the Cassandra equivalent for the SQL queries. I use CQL 3 and Cassandra v1.2. I modeled the db design in cassandra so that it supports the order by clauses and denormalized tables to support the join operation. However I am at sea when it comes to DISTINCT, SUM() and GROUPBY equvalents

SELECT a1,MAX(b1) FROM demo1 group by a1. SELECT DISTINCT (a2) FROM demo2 where b2='sea' SELECT sum(a3), sum(b3) from demo3 where c3='water' and d3='ocean'

这就像一个showstopper过去几天我的工作。在Cassandra中有一种方法,我可以建模数据库模式来支持这些类型的查询?我不能想到在Cassandra的任何方式。如何使用Cassandra实现这些查询?

This is like a showstopper to my work for past couple of days. Is there a way in Cassandra, that I can model the db schema to support queries of these kind? I cant think of any way in Cassandra . How are such queries be implemented using Cassandra?

我读到Cassandra上的hive层可能会使这些查询工作。我只是想知道,这是这样的查询可以支持Cassandra的唯一方法..? Pls建议任何其他可能的方法。

I read that a hive layer over Cassandra can possibly make these queries work. I am just wondering if that is the only way that such queries can be supported in Cassandra..? Pls advise on any other possible methods..

推荐答案

Cassandra不支持这样的操作。你可以使用顶部的Hive或者Acunu的一个(非免费)产品,它可以做你所需要的。

Cassandra doesn't support operations like this. You can use something like Hive on top or there's a (non-free) product from Acunu that may do what you need.

另一个解决方案是自己做工作。例如,您可以通过读取某些行中的所有数据并进行求和来求和。或者保持Cassandra计数器即时增加。

The other solution is to do the work yourself. For example, you can sum things by reading in all the data from certain rows and summing. Or maintain a Cassandra counter to increment on the fly.

更多推荐

MAX(),DISTINCT和Cassandra中的group by

本文发布于:2023-10-20 01:06:34,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1509374.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:DISTINCT   MAX   group   Cassandra

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!