Re: Box query
Date: 22 Apr 2006 18:30:24 -0700
Message-ID: <1145755824.134312.29660_at_u72g2000cwu.googlegroups.com>
Bob Badour wrote:
> Mikito Harakiri wrote:
>
> > Bob Badour wrote:
> >
> >>If you take a look at the second-to-last step, your query failed before
> >>it got to the having clause:
> >>
> >>Let tmp1 = { (box1,box2,exp(sum(ln(...)))) |
> >> (1,1,6), (1,2,3e-8),
> >> (2,1,3e-8), (2,2,6)
> >>}
> >
> > All right, let's make the case condition symmetric:
> >
> > having 1 = exp(sum(ln(
> > case when b2.low between b1.low and b1.high
> > *or* b1.low between b2.low and b2.high
> > then 1 else 0.00000001 end)))
>
> Changing the having clause won't fix a problem that already happened
> before the having clause is applied.
I'm changing the aggregation expression. Therefore, the result of
aggregation is different now:
Let tmp1 = { (box1,box2,exp(sum(ln(...*or*...)))) |
(1,1,1), (1,2,1),
Anyway, the condition if the two intervals [b1.low,b1.high] and
[b2.low,b2.high] intersect (for each dimension) is a simple expression
that depends on 4 numbers. Kind of obvious, isn't it? All what is
needed is aggregating it with the product aggregate -- which
corresponds to informal idea of the intersection volume. Alternatively,
we operate with 1s and 0s only, and could use boolean conjunction,
which is arithmetic min aggregate.
Received on Sun Apr 23 2006 - 03:30:24 CEST
(2,1,1), (2,2,1)
}