[storm] Do aggregate queries in storm imply an ORDER BY?

Stuart Bishop stuart at stuartbishop.net
Sat Jun 20 04:40:30 BST 2009



On Sat, Jun 20, 2009 at 2:08 AM, Jason Baker<jbaker at zeomega.com> wrote:
> There's one test in tests/store/base.py that I'm running in to trouble with:
>
>    def test_find_group_by_table(self):
>        result = self.store.find(
>            (Sum(FooValue.value2), Foo), Foo.id == FooValue.foo_id)
>        result.group_by(Foo)
>        foo1 = self.store.get(Foo, 10)
>        foo2 = self.store.get(Foo, 20)
>        self.assertEquals(list(result), [(5, foo1), (16, foo2)])
>
> This test is failing because list(result) looks like this:  [(16,
> foo2), (5, foo1)].  This is the same result, but in a different order.
>  I know at least at the SQL level, a query such as the above wouldn't
> be guaranteed to be in any order.  But is this the case with storm?

The test is broken. The ordering is undefined and has to be treated as random, and Storm can't do the sorting itself as this would involve sucking in the entire result set into RAM.


-- 
Stuart Bishop <stuart at stuartbishop.net>
http://www.stuartbishop.net/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 262 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/storm/attachments/20090620/721def26/attachment.pgp 


More information about the storm mailing list