-- -------------------------------------------------------------------------------------------------
-- Query2: Selection
-- -------------------------------------------------------------------------------------------------
-- Find bids with specific auction ids and show their bid price.
--
-- In original Nexmark queries, Query2 is as following (in CQL syntax):
--
--   SELECT Rstream(auction, price)
--   FROM Bid [NOW]
--   WHERE auction = 1007 OR auction = 1020 OR auction = 2001 OR auction = 2019 OR auction = 2087;
--
-- However, that query will only yield a few hundred results over event streams of arbitrary size.
-- To make it more interesting we instead choose bids for every 123'th auction.
-- -------------------------------------------------------------------------------------------------

CREATE TEMPORARY TABLE nexmark_q2 (
    auction BIGINT,
    price BIGINT
)
WITH ('connector' = 'blackhole');

INSERT INTO nexmark_q2
    SELECT
        auction, price
    FROM
        bid
    WHERE
        MOD(auction, 123) = 0;