Original code in Sort.java
The last line should be
The wrong order will make the planner choose the wrong physical plan. For example, if the druid query has a limit of 10 with 10+ dimensions, the optimizer will choose not push the "limit" down to druid instead choose scanning entire data source in druid.
The fix is very easy, the gain is huge as the performance of the wrong plan is really bad. Hope it will be picked up by the next release.