I agree. The Sort RelNode (or better, RelCollation) should have a constraint that prevents this. And SqlToRelConverter (or perhaps RelBuilder) should ignore sort keys that have appeared earlier in the key.
Can you log a jira case please. Julian > On Dec 19, 2017, at 5:56 PM, John Fang <[email protected]> wrote: > > Hi all, > I test the query "SELECT a, c FROM MyTable ORDER BY a DESC, a DESC". > And the collation of LogicalSort is "[0 DESC, 0 DESC]" , thus it will sort > by the repeater fields. I think the calcite should > removal the repeated fields, make the LogicalSort whose collation is "[0 > DESC]" be more reasonable. > -- > > Regards > > John Fang
