THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
Code Block | ||
---|---|---|
| ||
> SELECT * FROM Bid; -------------------------- | bidtime | price | item | -------------------------- | 8:07 | $2 | A | | 8:11 | $3 | B | | 8:05 | $4 | C | | 8:09 | $5 | D | | 8:13 | $1 | E | | 8:17 | $6 | F | -------------------------- > SELECT * FROM TABLE( TUMBLE(TABLE Bid, DESCRIPTOR(bidtime), INTERVAL '10' MINUTES)); -- or with the named params -- note: the DATA param must be the first > SELECT * FROM TABLE( TUMBLE( DATA => TABLE Bid, TIMECOL => DESCRIPTOR(bidtime), INTERVAL '10' MINUTES)); ------------------------------------------------------ | bidtime | price | item | window_start | window_end | ------------------------------------------------------ | 8:07 | $2 | A | 8:00 | 8:10 | | 8:11 | $3 | B | 8:10 | 8:20 | | 8:05 | $4 | C | 8:00 | 8:10 | | 8:09 | $5 | D | 8:00 | 8:10 | | 8:13 | $1 | E | 8:10 | 8:20 | | 8:17 | $6 | F | 8:10 | 8:20 | ------------------------------------------------------ > SELECT window_start, window_end, SUM(price) FROM TABLE( TUMBLE(TABLE Bid, DESCRIPTOR(bidtime), INTERVAL '10' MINUTES)) GROUP BY window_start, window_end; ------------------------------------- | window_start | window_end | price | ------------------------------------- | 8:00 | 8:10 | $11 | | 8:10 | 8:20 | $10 | ------------------------------------- |
...
data
is a table parameter that can be any relation with an time attribute column.timecol
is a column descriptor indicating which time attribute column of data should be mapped to tumbling windows.slide
is a duration specifying the duration between the start of sequential hopping windowssize
is a duration specifying the width of the hopping windows.offset
(optional) specifies that the hopping should begin from an instant other than the standard beginning of the epoch.
Here is an example invocation on the Bid table from the paper:
- other than the standard beginning of the epoch.
Here is an example invocation on the Bid table from the paper:
Code Block | ||
---|---|---|
| ||
> SELECT * FROM TABLE(
HOP(TABLE Bid, DESCRIPTOR(bidtime), INTERVAL '5' MINUTES, INTERVAL '10' MINUTES));
-- or with the named params
-- note: the DATA param must be the first
| ||
Code Block | ||
| ||
> SELECT * FROM TABLE( HOP( DATA => TABLE Bid, TIMECOL => DESCRIPTOR(bidtime),), SLIDE => INTERVAL '5' MINUTES, SIZE => INTERVAL '10' MINUTES)); ------------------------------------------------------ | bidtime | price | item | window_start | window_end | ------------------------------------------------------ | 8:07 | $2 | A | 8:00 | 8:10 | | 8:07 | $2 | A | 8:05 | 8:15 | | 8:11 | $3 | B | 8:05 | 8:15 | | 8:11 | $3 | B | 8:10 | 8:20 | | 8:05 | $4 | C | 8:00 | 8:10 | | 8:05 | $4 | C | 8:05 | 8:15 | | 8:09 | $5 | D | 8:00 | 8:10 | | 8:09 | $5 | D | 8:05 | 8:15 | | 8:13 | $1 | E | 8:05 | 8:15 | | 8:13 | $1 | E | 8:10 | 8:20 | | 8:17 | $6 | F | 8:10 | 8:20 | | 8:17 | $6 | F | 8:15 | 8:25 | ------------------------------------------------------ > SELECT window_start, window_end, SUM(price) FROM TABLE( HOP(TABLE Bid, DESCRIPTOR(bidtime), INTERVAL '5' MINUTES, INTERVAL '10' MINUTES)) GROUP BY window_start, window_end; -------------------------------------- | window_start | window_end | price | -------------------------------------- | 8:00 | 8:10 | $11 | | 8:05 | 8:15 | $15 | | 8:10 | 8:20 | $10 | | 8:15 | 8:25 | $6 | -------------------------------------- |
...
So a cumulating window for 1 hour step and 1 day max size will produce wndows: [00:00, 01:00), [00:00, 02:00), [00:00, 03:00), ..., [00:00, 24:00)
for every day.
Here is an example invocation on the Bid table:
)
for every day.
Here is an example invocation on the Bid table:
Code Block | ||
---|---|---|
| ||
> SELECT * FROM TABLE(
CUMULATE(TABLE Bid, DESCRIPTOR(bidtime), INTERVAL '2' MINUTES, INTERVAL '10' MINUTES));
-- or with the named params
-- note: the DATA param must be the first
| ||
Code Block | ||
| ||
> SELECT * FROM TABLE( CUMULATE( DATA => TABLE Bid, TIMECOL => DESCRIPTOR(bidtime), STEP => INTERVAL '2' MINUTES, SIZE => INTERVAL '10' MINUTES)); ------------------------------------------------------ | bidtime | price | item | window_start | window_end | ------------------------------------------------------ | 8:07 | $2 | A | 8:00 | 8:08 | | 8:07 | $2 | A | 8:00 | 8:10 | | 8:11 | $3 | B | 8:10 | 8:12 | | 8:11 | $3 | B | 8:10 | 8:14 | | 8:11 | $3 | B | 8:10 | 8:16 | | 8:11 | $3 | B | 8:10 | 8:18 | | 8:11 | $3 | B | 8:10 | 8:20 | | 8:05 | $4 | C | 8:00 | 8:06 | | 8:05 | $4 | C | 8:00 | 8:08 | | 8:05 | $4 | C | 8:00 | 8:10 | | 8:09 | $5 | D | 8:00 | 8:10 | | 8:13 | $1 | E | 8:10 | 8:14 | | 8:13 | $1 | E | 8:10 | 8:16 | | 8:13 | $1 | E | 8:10 | 8:18 | | 8:13 | $1 | E | 8:10 | 8:20 | | 8:17 | $6 | F | 8:10 | 8:18 | | 8:17 | $6 | F | 8:10 | 8:20 | ------------------------------------------------------ > SELECT window_start, window_end, SUM(price) FROM TABLE( CUMULATE(TABLE Bid, DESCRIPTOR(bidtime), INTERVAL '2' MINUTES, INTERVAL '10' MINUTES)) GROUP BY window_start, window_end; -------------------------------------- | window_start | window_end | price | -------------------------------------- | 8:00 | 8:06 | $4 | | 8:00 | 8:08 | $6 | | 8:00 | 8:10 | $11 | | 8:10 | 8:12 | $3 | | 8:10 | 8:14 | $4 | | 8:10 | 8:16 | $4 | | 8:10 | 8:18 | $10 | | 8:10 | 8:20 | $10 | -------------------------------------- |
...