gianm commented on issue #13951: URL: https://github.com/apache/druid/issues/13951#issuecomment-3023026952
The ordering the description calls "native order" is really something specific to the `topN` query. The one labeled "MSQ ordering" is more consistent with how other queries like `groupBy` and `windowOperator` (specifically the `naiveSort` operator) behave. In general most null-aware comparison code I've seen considers `null` as "smaller" than any non-null value, so nulls would appear last in descending order and first in ascending order. Actually, since #18074 changed planning to use `groupBy` rather than `topN` by default for queries like the one in the original description, that query would today return a resultset with `null` last. Btw, even `topN` isn't really internally consistent. When ordering by the dimension it puts `null` first regardless of whether the query runs in ascending or descending order. But when ordering by the metric, it puts `null` last, also regardless of asc/desc order. (I just learned this today when experimenting.) Given all this, IMO the best fix for this issue would be to adjust `topN` so it behaves like the other query types: `null` should appear first in `ASC` order, last in `DESC` order. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
