Details
-
Sub-task
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
Define a builtin TVF: Tumble (data , timecol , dur, [ offset ])
The return value of Tumble is a relation that includes all columns of data as well as additional event time columns window_start and window_end.
Examples of TUMBLE TVF are (from https://s.apache.org/streaming-beam-sql ):
8:21> 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 |
--------------------------
8:21> SELECT *
FROM TABLE Tumble (
data => TABLE Bid ,
timecol => DESCRIPTOR ( bidtime ) ,
dur => INTERVAL '10' MINUTES ,
offset => INTERVAL '0' MINUTES );
------------------------------------------
window_start | window_end | bidtime | price | item |
------------------------------------------
8:00 | 8:10 | 8:07 | $2 | A |
8:10 | 8:20 | 8:11 | $3 | B |
8:00 | 8:10 | 8:05 | $4 | C |
8:00 | 8:10 | 8:09 | $5 | D |
8:10 | 8:20 | 8:13 | $1 | E |
8:10 | 8:20 | 8:17 | $6 | F |
------------------------------------------
8:21> SELECT MAX ( window_start ) , window_end , SUM ( price )
FROM TABLE Tumble (
data => TABLE ( Bid ) ,
timecol => DESCRIPTOR ( bidtime ) ,
dur => INTERVAL '10 ' MINUTES )
GROUP BY wend;
-------------------------
window_start | window_end | price |
-------------------------
8:00 | 8:10 | $11 |
8:10 | 8:20 | $10 |
-------------------------
Attachments
Issue Links
- is blocked by
-
CALCITE-3339 DESCRIPTOR as a SQL operator in SqlStdOperatorTable
- Closed
-
CALCITE-3340 Support Table-valued Function TUMBLE in Planner
- Closed
-
CALCITE-3343 Improve LogicalTableFunctionScan to match table function windowing
- Closed
-
CALCITE-3501 Improve EnumerableTableFunctionScan's implement() for table value function windowing
- Closed
-
CALCITE-3499 EnumerableTableFunctionScanRule doesn't convert its inputs to Enumerable.CONVENTION
- Closed
- is related to
-
CALCITE-1490 Allow table functions without explicit TABLE
- Resolved
- links to