Sliding windows are so different from tumbling windows that it doesn’t make 
sense to give them a “window key”. With sliding windows, every row has its own 
window. So, given a row R you determine what rows are in R’s window based on 
its windowing criteria, e.g. “rows between 5 preceding and 5 following 
partition by productId”, or “order by rowtime range ‘1’ minute preceding”.

There is no instantaneous flush of a hash table, as occurs in tumbling windows.

Julian


On May 5, 2015, at 4:04 PM, Yi Pan <nickpa...@gmail.com> wrote:

> Hi, Julian,
> 
> Great! I am looking forward to it. Could you help to answer my question
> regarding to the sliding windows in the previous email?
> 
> Thanks a lot!
> 
> -Yi
> 
> On Tue, May 5, 2015 at 10:46 AM, Julian Hyde <jul...@hydromatic.net> wrote:
> 
>> 
>> On May 4, 2015, at 10:52 AM, Yi Pan <nickpa...@gmail.com> wrote:
>> 
>>> Just one observation that I wanted to add in: I noted that actually any
>>> range-based query clause on an ordered stream essentially means the need
>>> for a windowing method in the ordered stream scan. Is it possible to
>>> identify a common syntax expression from the query parser in Calcite for
>>> any range-based clauses on a StreamScan operator and extract the window
>>> spec like:
>>> LogicalProject(...)
>>>  StreamScan(table=[[STREAMS, ORDERS]], fields=[[0,1,2,3]])
>>> 
>>> To:
>>> LogicalProject(...)
>>>  LogicalWindow(<WindowSpec from the range defining expression in
>>> LogicalProject>)
>>>     StreamScan(table=[[STREAMS, ORDERS]], fields=[[0,1,2,3]])
>> 
>> Yes, I plan to do this.
>> 
>> Calcite treats LogicalWindow is a bit differently from the other logical
>> operators. A query that contains a windowed aggregate such as  “SUM(units)
>> OVER <window>” is first translated to a LogicalProject that contains
>> windowed aggregates as if they were ordinary function calls, then
>> ProjectToWindowRule converts that LogicalProject to a LogicalWindow.
>> 
>> But by the time Samza sees the relational expressions you can assume that
>> all windowed aggregates have been moved into a LogicalWindow.
>> 
>> I have logged https://issues.apache.org/jira/browse/CALCITE-713.
>> 
>> Julian
>> 
>> 

Reply via email to