Is it correct that I need to override org.apache.calcite.rel.AbstractRelNode.register and add rule SortRemoveRule.INSTANCE ?
But while it checks RelCollation, then I should also somehow set it. But I could not find how to do it. On Fri, Oct 30, 2015 at 4:23 PM, Alexander Reshetov <[email protected]> wrote: > Here some clarification of my intends. > > Calcite choosing next plan: > > +------+ > | PLAN | > +------+ > | EnumerableSort(sort0=[$0], dir0=[DESC]) > ArchiveTableScan(table=[[MAIN, SUB]], fields=[[0, 1, 2, 3, 4, 5, 6, > 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21]]) > | > +------+ > > > The problem is invocation of EnumerableSort. Because data already > sorted by one column. So I need to force exclusion of EnumerableSort > from planner. > > Do I need implement some interface or override some method to achieve this? > > On Fri, Oct 30, 2015 at 9:51 AM, Julian Hyde <[email protected]> wrote: >> Yes, this is possible. In fact Phoenix does exactly this. >> >> Take a look at https://issues.apache.org/jira/browse/CALCITE-818 and >> https://issues.apache.org/jira/browse/CALCITE-71, which were fixed along the >> way. >> >>> On Oct 29, 2015, at 1:16 AM, Alexander Reshetov >>> <[email protected]> wrote: >>> >>> Hello, >>> >>> I have kinda theoretical question. But it should help to understand >>> overall Calcite's possibility. >>> >>> Suppose there is some abstract format/table, which supports only >>> sorting by one column. >>> >>> Let's say there is next query passed to calcite: >>> >>> select * from table order by id >>> >>> Is it possible to rewrite query tree so it will change this request into >>> this? >>> >>> select * from table >>> >>> In this way after logical query rewrite Calcite should not be >>> concerned about sorting at all. >>
