Open jhellerstein opened 13 years ago
This should be easily to fix; I'll take a look tomorrow morning.
BTW, this sort of property is pretty fragile (especially given the Ruby style of omitting an explicit return
statement). We should probably document it clearly when an interface method is expected to return a particular value.
This actually doesn't seem that easy to (cleanly) fix. The problem is that lefts
currently returns an Array constructed by calling map, rather than a BudCollection. We'll need to wrap the Array inside a BudCollection, which should be doable; it would be nice to avoid a deep copy of the actual data, which I think we can also do.
BTW, doesn't exactly the same problem occur if you just call map
on a BudCollection and expect the result to be a BudCollection?
Peter will take a look at this. BTW, here's a partial test case for the problem:
class ChainJoinsWithGroup
include Bud
state do
scratch :s1, [:a, :b]
scratch :s2, [:a, :b]
scratch :r1, [:key] => [:val_min]
scratch :r2, [:key] => [:val_max]
end
bootstrap do
s1 <= [[5, 10], [5, 12], [8, 19], [8, 20]]
s2 <= [[5, 5], [8, 25]]
end
bloom do
r1 <= (s1 * s2).lefts(:a => :a).group([:a], min(:b))
r2 <= (s1 * s2).rights(:a => :a).group([:a], max(:b))
end
end
add flat_map to the list of methods that need to produce a BudCollection. just tripped across a bug resulting from that (which I'm working around for now.)
As a result you can't cascade to BudCollection#argmin or BudCollection#group, etc.