Re: Rule to eliminate a redundant LogicalSort

2017-06-27 Thread Michael Alexeev
Atri, Julian, Thank you very much for your responses. Is there a chance that this rule will make it into the upcoming 1.13.0 release? Mike On Tue, Jun 27, 2017 at 4:17 PM, Julian Hyde wrote: > > Atri Sharma wrote: > > > > but have hit a bug in HepPlanner which Julian is

Re: Rule to eliminate a redundant LogicalSort

2017-06-27 Thread Julian Hyde
> Atri Sharma wrote: > > but have hit a bug in HepPlanner which Julian is looking into. For the record, I am not actively looking into the bug. > Michael Alexeev wrote: > > Is SortRemoveRule supposed to address this - Planner rule to remove Sort if > its input is already sorted. > > Looking at

Re: Rule to eliminate a redundant LogicalSort

2017-06-27 Thread Atri Sharma
Hi Michael, I am currently working on 873 which address this exact use case. I have the patch ready but have hit a bug in HepPlanner which Julian is looking into. Post that, I should be able to push the JIRA and get this rule in. Will be glad for your review on it On Jun 27, 2017 8:22 PM,

Re: Rule to eliminate a redundant LogicalSort

2017-06-26 Thread Julian Hyde
Is there a JIRA case for this? It sounds similar to what Atri is working on. Also, I think I ran into it while I was extending Atri’s partial fix for https://issues.apache.org/jira/browse/CALCITE-873 in

Re: Rule to eliminate a redundant LogicalSort

2017-06-20 Thread Michael Mior
The LogicalSort in this case can be pushed passed the LogicalJoin (e.g. via SortJoinTransposeRule) so it's child would still be the TableScan and the rule would still match. -- Michael Mior mm...@apache.org 2017-06-20 20:47 GMT-04:00 Michael Alexeev : > Michael, > >

Re: Rule to eliminate a redundant LogicalSort

2017-06-20 Thread Michael Alexeev
Michael, Yes, this would work in this case but what about a bit more complicated example with join SELECT R1.I FROM R1 JOIN R2 on R1.I = R2.II ORDER BY R1.I; Here, the order will still be guaranteed by the R1 index and the sort can be eliminated but there will be a LogicalJoin in between the

Re: Rule to eliminate a redundant LogicalSort

2017-06-20 Thread Michael Mior
You may find it easier to just have your rule explicitly match a LogicalSort on top of a TableScan. Then you can just simply check the indices of the fields. Existing rules should help reorder other operators to produce a tree of this form if needed. -- Michael Mior mm...@apache.org 2017-06-19