Re: Re: Re: Problem with converters and possibly rule matching

2019-11-19 Thread Vladimir Ozerov
ain/java/devozerov/HazelcastConventions.java#L44 > > >> > > >> Try this: > > >> > > >> fromTraits.containsIfApplicable(Convention.PHYSICAL) > > >> && toTraits.containsIfApplicable(Convention.PHYSICAL); > > >> >

Re: Re: Re: Problem with converters and possibly rule matching

2019-11-15 Thread Stamatis Zampetakis
AL) > >> && toTraits.containsIfApplicable(Convention.PHYSICAL); > >> > >> > >> Adding a AbstractConverter on logical operators is meaningless. Calcite > >> is mixing the concept of logical and physical together, which is sad. > >> > >>

Re: Re: Re: Problem with converters and possibly rule matching

2019-11-14 Thread Vladimir Ozerov
, >>> >>> This is still can be done through top-down request approach. >>> >>> PhysicalFilter operator should request ANY distribution from child >>> operator, unless there is outer reference in the filter condition, in which >>> case, PhysicalF

Re: Re: Re: Problem with converters and possibly rule matching

2019-11-14 Thread Vladimir Ozerov
> 发件人:Vladimir Ozerov > 日 期:2019年11月05日 18:02:15 > 收件人:Haisheng Yuan > 抄 送:dev@calcite.apache.org (dev@calcite.apache.org) > > 主 题:Re: Re: Problem with converters and possibly rule matching > > Hi Haisheng, > > think I already tried something very similar

Re: Re: Re: Problem with converters and possibly rule matching

2019-11-05 Thread Haisheng Yuan
Haisheng -- 发件人:Vladimir Ozerov 日 期:2019年11月05日 18:02:15 收件人:Haisheng Yuan 抄 送:dev@calcite.apache.org (dev@calcite.apache.org) 主 题:Re: Re: Problem with converters and possibly rule matching Hi Haisheng, think I already tried something very similar to what you explained, but

Re: Re: Problem with converters and possibly rule matching

2019-11-05 Thread Vladimir Ozerov
rule. > Note that IndexGet is a logical operator and IndexScan is a physical > operator, which are also used by SQL Server. > > - Haisheng > > -- > 发件人:Vladimir Ozerov > 日 期:2019年11月01日 17:30:26 > 收件人: > 主 题:Re: Problem with converters and possibly ru

Re: Problem with converters and possibly rule matching

2019-11-04 Thread Julian Hyde
Scan physical implementation rule. > Note that IndexGet is a logical operator and IndexScan is a physical > operator, which are also used by SQL Server. > > - Haisheng > > -- > 发件人:Vladimir Ozerov > 日 期:2019年11月01日 1

Re: Re: Problem with converters and possibly rule matching

2019-11-03 Thread Haisheng Yuan
and IndexScan is a physical operator, which are also used by SQL Server. - Haisheng -- 发件人:Vladimir Ozerov 日 期:2019年11月01日 17:30:26 收件人: 主 题:Re: Problem with converters and possibly rule matching Hi Stamatis, Thank you for your

Re: Problem with converters and possibly rule matching

2019-11-01 Thread Vladimir Ozerov
Hi Stamatis, Thank you for your reply. I also thought that we may set the distribution trait during logical planning because it is known in advance. And the example I gave will work! :-) But unfortunately, it will work only because the tree is very simple, and the Project is adjacent to the Scan.

Re: Problem with converters and possibly rule matching

2019-11-01 Thread Seliverstov Igor
Stamatis, Small comment from me, for distributed systems is more efficient if SINGLETON distribution appears only on root node, in other words as late as possible, it allows to filter or cut rows (project) on source nodes which significantly reduces network costs. To do that (In case we use

Re: Problem with converters and possibly rule matching

2019-11-01 Thread Stamatis Zampetakis
The discussion is interesting thanks for the nice examples. I am replying in this thread since it has all the examples and the history of the conversation. *Part I: Distribution physical or logical property* The Volcano paper writes the following regarding properties: "Logical properties can be

Re: Problem with converters and possibly rule matching

2019-10-30 Thread Vladimir Ozerov
Hi Stamatis, The problem that the presented reproducer is a very simplified version of what is actually needed. In reality, there are several distribution types - PARTITIONED, REPLICATED, SINGLETON. To make things worse, PARTITIONED may or may not have concrete distribution fields. In theory, I

Re: Problem with converters and possibly rule matching

2019-10-30 Thread Stamatis Zampetakis
I admit that I didn't thoroughly read the exchanges so far but forcing the rules trigger does not seem the right approach. Other than that I would like to backtrack a bit to point 4.3 raised by Vladimir. "ProjectPhysicalRule [6] - transforms logical project to physical project *ONLY* if there is

Re: Problem with converters and possibly rule matching

2019-10-30 Thread Seliverstov Igor
Unfortunately it requires package-private API usage. Best solution there if Calcite provide it for end users. ср, 30 окт. 2019 г., 18:48 Vladimir Ozerov : > “e pension” == “expand conversion” :) > > ср, 30 окт. 2019 г. в 18:46, Vladimir Ozerov : > > > Yes, that may work. Even if e pension rule

Re: Problem with converters and possibly rule matching

2019-10-30 Thread Vladimir Ozerov
Yes, that may work. Even if e pension rule is used, for the most cases it will not trigger any real conversions, since we are moving from abstract convention to physical, and created converters will have the opposite trait direction (from physical to abstract). But again - ideally we only need to

Re: Problem with converters and possibly rule matching

2019-10-30 Thread Vladimir Ozerov
“e pension” == “expand conversion” :) ср, 30 окт. 2019 г. в 18:46, Vladimir Ozerov : > Yes, that may work. Even if e pension rule is used, for the most cases it > will not trigger any real conversions, since we are moving from abstract > convention to physical, and created converters will have

Re: Problem with converters and possibly rule matching

2019-10-30 Thread Seliverstov Igor
I considered manual rules calling too, for now we use abstract converters + ExpandConversionRule for exchanges producing. You may create such converters manually (checking appropriate subset) this case you may reduce created converters count, also, a converter is a quite special node, that does

Re: Problem with converters and possibly rule matching

2019-10-30 Thread Vladimir Ozerov
One funny hack which helped me is manual registration of a fake RelNode with desired traits through VolcanoPlanner.register() method. But again, this leads to trashing. What could really help is a call to VolcanoPlanner.fireRules() with desired rel. But this doesn't work out of the box since some

Re: Problem with converters and possibly rule matching

2019-10-30 Thread Vladimir Ozerov
Hi Igor, Yes, I came to the same conclusion, thank you. This is how it basically happens when converters are disabled: 1) We start with initial tree: [LogicalProject] <- [LogicalScan] 2) Then we convert LogicalScan to PhysicalScan, so it is added to the set: [LogicalProject] <- [LogicalScan,

Re: Problem with converters and possibly rule matching

2019-10-30 Thread Seliverstov Igor
Vladimir, Probably it'll help you: Seems the cause of issue in RelSubset.getParentRels() The check used when the planner schedules newly matched rules after successful transformation (see VolcanoRuleCall.matchRecurse), it prevents the parent rule be applied once again (here your logical project

Re: Problem with converters and possibly rule matching

2019-10-29 Thread Vladimir Ozerov
Hi Vladimir, I am sorry. Pushed, it works now. вт, 29 окт. 2019 г. в 14:41, Vladimir Sitnikov : > > mvn clean test > > [ERROR] The goal you specified requires a project to execute but there is > no POM in this directory > > Vladimir, please push missing files > > Vladimir >

Re: Problem with converters and possibly rule matching

2019-10-29 Thread Vladimir Sitnikov
> mvn clean test [ERROR] The goal you specified requires a project to execute but there is no POM in this directory Vladimir, please push missing files Vladimir

Re: Problem with converters and possibly rule matching

2019-10-29 Thread Vladimir Ozerov
Hi colleagues, I prepared (relatively) simple reproducer for the problem [1]. It can be executed with three commands: git clone https://github.com/devozerov/calcite-optimizer.git cd calcite-optimizer mvn clean test Please do not pay attention to stuff located inside "org.apache.calcite" package,

Re: Problem with converters and possibly rule matching

2019-10-29 Thread Vladimir Ozerov
Hi everybody, First of all, thank you for answers and suggestions. Let me address them briefly: 1) I use two conventions at the moment, LOGICAL and PHYSICAL. I agree with you that this might be overkill, and there is a chance that in the final solution we may end up with only one. But meanwhile

Re: Problem with converters and possibly rule matching

2019-10-29 Thread Seliverstov Igor
Vladimir, I guess Project rule doesn't have a child matcher. Put into it child "any" match rule and it will apply on each child node transformation. Regards, Igor вт, 29 окт. 2019 г., 7:07 Danny Chan : > Vladimir, all you need to do is to change the convention of the root node, > the volcano

Re: Problem with converters and possibly rule matching

2019-10-28 Thread Danny Chan
Vladimir, all you need to do is to change the convention of the root node, the volcano would propagate the convention to all its input nodes when registering them to the planner. You can take this code [1] for reference :) [1] 

Re: Re: Problem with converters and possibly rule matching

2019-10-28 Thread Haisheng Yuan
. - Haisheng -- 发件人:Stamatis Zampetakis 日 期:2019年10月29日 06:10:45 收件人: 主 题:Re: Problem with converters and possibly rule matching Hi Vladimir, You can get an idea of how the Volcano planner works by reading [1]. The implementation of the Volcano in Calcite has many differences

Re: Problem with converters and possibly rule matching

2019-10-28 Thread Stamatis Zampetakis
Hi Vladimir, You can get an idea of how the Volcano planner works by reading [1]. The implementation of the Volcano in Calcite has many differences but the main ideas are there. Normally you do not need to set canConvertConvention to true; especially in your case it doesn't seem necessary. I