I should have said that

   SELECT * FROM order_item o JOIN product p USING(product_id)

(without the "STREAM" keyword) is a time-varying relation. You can
execute it at 10am, and it terminates, and again at 10.10am and get
different results. The difference is due to differences in both
product and order_item.

If you want to join based on when the order was placed, you must have
a column that records the order time. Beyond that, I'm not sure of the
details - you may be able to use AS OF, there may be a
system-maintained column that records when product was last updated.

Julian

On Fri, Mar 20, 2020 at 12:01 AM Viliam Durina <vil...@hazelcast.com> wrote:
>
> On Thu, 19 Mar 2020 at 21:04, Julian Hyde <jh...@apache.org> wrote:
>
> Suppose you execute that query at 10am and get a particular result. ... you
> > execute again at 10.10am.
> >
>
> I execute that query at 10am and expect it to run continuously. My
> understanding is that a query with `EMIT STREAM` will run continuously.
> Does it just fetch results and finish?
>
> Now, if you have particular time-sensitive join semantics - such as wanting
> > to join the order_item to the product table as if was at the time the order
> > was placed - you will need to express that explicitly in the join condition.
> >
>
> How would such a query look? Could you write it? There's no time column in
> either relation.
>
> Regards,
> Viliam
>
> --
> This message contains confidential information and is intended only for the
> individuals named. If you are not the named addressee you should not
> disseminate, distribute or copy this e-mail. Please notify the sender
> immediately by e-mail if you have received this e-mail by mistake and
> delete this e-mail from your system. E-mail transmission cannot be
> guaranteed to be secure or error-free as information could be intercepted,
> corrupted, lost, destroyed, arrive late or incomplete, or contain viruses.
> The sender therefore does not accept liability for any errors or omissions
> in the contents of this message, which arise as a result of e-mail
> transmission. If verification is required, please request a hard-copy
> version. -Hazelcast

Reply via email to