[storm] Query using count

Jamu Kakar jamshed.kakar at canonical.com
Fri Jul 20 23:39:32 BST 2007


Hi Akira,

akira wrote:
> this has brought me since yesterday to a grinding halt, I have run out
> of ideas. Could someone tell me how to code this using Storm?
>
> SELECT n.name,  COUNT(*)-1 AS level
>
> I just dont know how to use Storms cout in such a query.

I'm not sure I actually understand what you expect out of that query.
Perhaps the following will help anyway: a query can yield a count by
using the count() method on a ResultSet.  For example, consider
counting Person instances.  You can do this to count all Persons whose
name starts with Bob:

count = store.find(Person, Person.name.like("Bob%")).count()

Or this to count all Persons:

count = store.find(Person).count()

Does that help?

Thanks,
J.



More information about the storm mailing list