A disappearing Sort operator makes me think of SortRemoveRule. I am not sure if you are using this rule but it might worth setting a breakpoint at the onMatch method.
Since your problem seems related with the RelCollationTraitDef you may also want to look in RelCollationTraitDef#convert method. Στις Δευ, 24 Σεπ 2018 στις 11:05 μ.μ., ο/η Enrico Olivelli < eolive...@gmail.com> έγραψε: > Il lun 24 set 2018, 13:50 Enrico Olivelli <eolive...@gmail.com> ha > scritto: > > > > > > > Il dom 23 set 2018, 22:22 Vladimir Sitnikov <sitnikov.vladi...@gmail.com > > > > ha scritto: > > > >> Enrico, > >> > >> 1) EnumerableMergeJoinRule does not seem to work (see > >> https://issues.apache.org/jira/browse/CALCITE-2592 ). > >> It seems to be broken since Calcite 1.9.0 > >> > >> 2) It turns out you need to add RelTraitDefs explicitly to the planner, > >> otherwise it just ignores the traits (or something like that). > >> > >> Would you please try > >> adding org.apache.calcite.rel.RelCollationTraitDef#INSTANCE to the list > of > >> traits you use for planning? (see > >> > >> > https://github.com/diennea/herddb/blob/0c7c01584350d57d8102511b987e5f880f3f65bd/herddb-core/src/main/java/herddb/sql/CalcitePlanner.java#L412 > >> ) > >> > >> It works! > >> > > > > Now the planner does not choose a merge join as expected. And I guess it > > will never do so due the bug you have mentioned > > > > Too early. > Now the planner is stripping every EnumerableSort from the plan, leading to > wrong results at every query with 'order by' > I am debugging... > Maybe any bell rings... > > > Enrico > > > > > > Thank you very much > > > > Enrico > > > > > >> > >> PS. You are using a somewhat creative way of planning the whole thing as > >> Enumerable then converting the plan relations to your own format. > >> > > > > Uh > > Othewise I should have created my own Convention, but as far I understand > > it is not really needed, in the future maybe we refactor the whole > > integration with Calcite > > > > Enrico > > > > > >> Vladimir > > > > > >> -- > > > > > > -- Enrico Olivelli > > > -- > > > -- Enrico Olivelli >