THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
Code Block | ||
---|---|---|
| ||
SESSION(data, DESCRIPTOR(timecol), DESCRIPTOR [PARTITION BY (keycols, [,...)], DESCRIPTOR(timecol), gap) |
data
is a table parameter that can be any relation with an time attribute column.keycols
is a column descriptor indicating which columns should be used to partition the data prior to sessionizationtimecol
is a column descriptor indicating which time attribute column of data should be mapped to tumbling windows.keycols
is a column descriptor indicating which columns should be used to partition the data prior to sessionizationgap
is the maximum difference in timestamp for two events to be considered part of the same sessions
...
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 timecol => DESCRIPTOR(bidtime)BY bidder, keycolstimecol => DESCRIPTOR(bidderbidtime), 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 | ---------------------------------------------------------------- |
...
The existing Grouped window functions, i.e. GROUP BY TUMBLE...
are still supported. We don't have a plan to deprecate or remove the existing window APIs so far, but will be deprecated. We can drop the old syntax at some point in the future, but this needs another public discussion. We should update the examples, docs to only use the new one. The support for Table API is a future work and should be in a separate FLIP.
...