Re: Sort getting removed during optimization

2022-01-13 Thread Vladimir Ozerov
anks! > Julian > > > > From: Vladimir Ozerov > Date: Tuesday, 11. January 2022 at 14:09 > To: dev@calcite.apache.org (dev@calcite.apache.org) < > dev@calcite.apache.org> > Subject: Re: Sort getting removed during optimization > Hi Julian, > > When invoking the op

Re: Sort getting removed during optimization

2022-01-11 Thread Julian Feinauer
ke the left rel) and then the remaining > entries from the right side (also ordered). But overall not ordered. > > Best > Julian > > From: Stamatis Zampetakis > Date: Tuesday, 11. January 2022 at 09:43 > To: dev@calcite.apache.org > Subject: Re: Sort getting removed during opt

Re: Sort getting removed during optimization

2022-01-11 Thread Vladimir Ozerov
ke the left rel) and then the remaining > entries from the right side (also ordered). But overall not ordered. > > Best > Julian > > From: Stamatis Zampetakis > Date: Tuesday, 11. January 2022 at 09:43 > To: dev@calcite.apache.org > Subject: Re: Sort getting removed during optimization

Re: Sort getting removed during optimization

2022-01-11 Thread Julian Feinauer
. Best Julian From: Stamatis Zampetakis Date: Tuesday, 11. January 2022 at 09:43 To: dev@calcite.apache.org Subject: Re: Sort getting removed during optimization Hi Julian F, Quite a naive question but did you get wrong results from the given plan? A missing sort is not necessarily problematic

Re: Sort getting removed during optimization

2022-01-11 Thread Stamatis Zampetakis
very much! > Julian > > From: Julian Hyde > Date: Tuesday, 11. January 2022 at 00:38 > To: dev@calcite.apache.org > Subject: Re: Sort getting removed during optimization > Is it possible that the Sort is being removed because some component knows > that the input is al

Re: Sort getting removed during optimization

2022-01-10 Thread Julian Feinauer
a wrong Collation or the SortRemoveRule investigating the input Collation wrong, or? But nonetheless, thank you very much! Julian From: Julian Hyde Date: Tuesday, 11. January 2022 at 00:38 To: dev@calcite.apache.org Subject: Re: Sort getting removed during optimization Is it possible

Re: Sort getting removed during optimization

2022-01-10 Thread Julian Hyde
Is it possible that the Sort is being removed because some component knows that the input is already sorted? In particular, if a relation has at most one row, it is always sorted. Maybe the planner is deducing this via a some row-count metadata or uniqueness constraint. > On Jan 10, 2022, at

Re: Sort getting removed during optimization

2022-01-10 Thread xiong duan
If I understand correctly, If we remove the BINDABLE_SORT_RULE, the result will throw an exception about the Plan transformation. So it looks like a wrong rule's result. If you don't customize the rule, It is a bug, and please test this using Calcite's new version.

Sort getting removed during optimization

2022-01-10 Thread Julian Feinauer
Hi all, I just observed a Plan transformation that I don’t quite understand. The Logical Plan is: LogicalSort(sort0=[$0], dir0=[DESC]) LogicalProject(time=[COALESCE($0, $2)], s1=[$1], s0=[$3]) LogicalJoin(condition=[=($0, $2)], joinType=[full]) LogicalTableScan(table=[[root,