[ https://issues.apache.org/jira/browse/CALCITE-2102?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
John Fang updated CALCITE-2102: ------------------------------- Description: 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 order by the repeater fields. I think the calcite should removal the repeated fields, thus it make the LogicalSort whose collation is {{[0 DESC]}} be more reasonable. Considering compatibility,it may be better make SqlToRelConverter (or perhaps RelBuilder) ignore sort keys that have appeared earlier in the key. In addition, it should also prevent the incompatible sort keys. It should throw illegalargumentexception for the query {{SELECT a, c FROM MyTable ORDER BY a DESC, a ASC}} because of the incompatibility. was: 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 order by the repeater fields. I think the calcite should removal the repeated fields, thus it make the LogicalSort whose collation is "[0 DESC]" be more reasonable. Considering compatibility,it may be better make SqlToRelConverter (or perhaps RelBuilder) ignore sort keys that have appeared earlier in the key. In addition, it should also prevent the incompatible sort keys. It should throw illegalargumentexception for the query "SELECT a, c FROM MyTable ORDER BY a DESC, a ASC" because of the incompatibility. > RelCollation should have a constraint to limit the repeat or incompatible > RelFieldCollations. > ---------------------------------------------------------------------------------------------- > > Key: CALCITE-2102 > URL: https://issues.apache.org/jira/browse/CALCITE-2102 > Project: Calcite > Issue Type: Bug > Reporter: John Fang > Assignee: Julian Hyde > > 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 order > by the repeater fields. I think the calcite should removal the repeated > fields, thus it make the LogicalSort whose collation is {{[0 DESC]}} be more > reasonable. > Considering compatibility,it may be better make SqlToRelConverter (or > perhaps RelBuilder) ignore sort keys that have appeared earlier in the key. > In addition, it should also prevent the incompatible sort keys. It should > throw illegalargumentexception for the query {{SELECT a, c FROM MyTable ORDER > BY a DESC, a ASC}} because of the incompatibility. -- This message was sent by Atlassian JIRA (v6.4.14#64029)