LogicalWindow is used internally. If you write a query with a windowed 
aggregate (say “SELECT SUM(x) OVER …”) it is converted to LogicalProject, which 
is converted by ProjectToWindowRule to a LogicalWindow, which is converted by 
other rules to a physical operator such as EnumerableWindow.

Initially we allow windowed aggregates (represented as RexOver) to be mixed in 
with other expressions in LogicalProject (just like in a SELECT clause) but 
later we segregate windowed aggregates into LogicalWindow. This means that 
other planner rules don’t have to worry about tripping up on a type of 
expression they don’t understand.

Julian

> On May 27, 2016, at 7:02 PM, Zhangrucong <[email protected]> wrote:
> 
> Hi Julian:
>        Thank you very much for your reply.
> 
> My question is this:
> In the calcite code,there is a LogicalWindow. When to use it?
> 
> I have another question, for window syntax,  RANGE 
> numericOrIntervalExpression { PRECEDING | FOLLOWING }. How to understand 
> flowing for stream?  Can you give me a example? 
> 
> Thanks in advance!
> 
> 
> -----邮件原件-----
> 发件人: Julian Hyde [mailto:[email protected]] 
> 发送时间: 2016年5月28日 8:51
> 收件人: [email protected]
> 主题: Re: Some questions
> 
> HepPlanner is a rule-based planner that applies a small set of rules in a 
> particular order to every relational expression in a tree. It is generally 
> used for quick once-over rewrites.
> 
> VolcanoPlanner is a cost-based planner that applies all rules, generates new 
> relational expressions, and then keeps on firing the rules until nothing else 
> matches. It is easier to use (you don't have to specify which order the rules 
> will be applied) but it can be expensive, especially on complex queries, 
> because it is exhaustive.
> 
> I recommend using VolcanoPlanner at first, then use a hybrid strategy when 
> you need to deal with complex queries (e.g. queries with more than about 6 
> joins).
> 
> I don't understand your question 2. Can you give an example of a query and 
> the plan it produces?
> 
> Julian
> 
> 
> 
> On Thu, May 26, 2016 at 11:23 PM, Zhangrucong <[email protected]> wrote:
>> Hello everyone:
>> 
>> Now I am learning calcite streamSQL. I have two questions. Anyone can help 
>> me. Thanks in advance.
>> 
>> The questions are following:
>> 
>> 1、  what is the difference between HepPlanner  and VolcanoPlanner? For 
>> streamSQL ,which one is better? Are there have some materials to introduce 
>> two models?
>> 
>> 2、  In the logic plan tree, window is combined with aggregate node or 
>> expression node. In which case,  there is a lonely window node in logic plan?

Reply via email to