THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
Code Block | ||
---|---|---|
| ||
> SELECT * FROM Bid;
------------------------------------
| bidtime | price | item | bidder |
------------------------------------
| 8:07 | $2 | A | takidau |
| 8:05 | $1 | A | klk |
| 8:09 | $10 | B | takidau |
| 8:08 | $3 | A | klk |
| 8:17 | $20 | B | klk |
------------------------------------
> SELECT *
FROM TABLE(
SESSION(TABLE Bid PARTITION BY bidder, DESCRIPTOR(bidtime), DESCRIPTOR(bidder), INTERVAL '5' MINUTES);
-- or with the named params
-- note: the DATA param must be the first
> SELECT *
FROM SESSION(
data => TABLE Bids PARTITION BY bidder,
timecol => DESCRIPTOR(bidtime),
gap => INTERVAL '5' MINUTES);
----------------------------------------------------------------
| bidtime | price | item | bidder | window_start | window_end |
----------------------------------------------------------------
| 8:07 | $2 | A | takidau | 8:07 | 8:14 |
| 8:05 | $1 | A | klk | 8:05 | 8:13 |
| 8:09 | $10 | B | takidau | 8:07 | 8:14 |
| 8:08 | $3 | A | klk | 8:05 | 8:13 |
| 8:17 | $20 | B | klk | 8:17 | 8:22 |
----------------------------------------------------------------
> SELECT bidder, window_start, window_end, SUM(price)
FROM TABLE(
SESSION(TABLE Bid PARTITION BY bidder, DESCRIPTOR(bidtime), DESCRIPTOR(bidder), INTERVAL '5' MINUTES)
GROUP BY bidder, window_start, window_end;
-----------------------------------------------
| bidder | window_start | window_end | price |
-----------------------------------------------
| takidau | 8:07 | 8:14 | $12 |
| klk | 8:05 | 8:13 | $4 |
| klk | 8:17 | 8:22 | $20 |
----------------------------------------------- |
Operations on windows
We also would like to support various operations based on the windowing TVFs. This can make the functionality more complete.
...