[storm] Do aggregate queries in storm imply an ORDER BY?
Jason Baker
jbaker at zeomega.com
Mon Jun 22 15:58:34 BST 2009
On Sat, Jun 20, 2009 at 1:43 AM, Jamu Kakar<jkakar at kakar.ca> wrote:
> Hi,
>
> On Fri, Jun 19, 2009 at 8:40 PM, Stuart Bishop<stuart at stuartbishop.net> wrote:
>> 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.
>
> The test isn't about ordering, it's about making sure group_by does
> the right thing, so I think it'd be fine to replace the list(result)
> in the assertion with sorted(result).
>
> Thanks,
> J.
>
That makes the test pass. Thanks for looking into this for me, guys.
More information about the storm
mailing list