mingmwang commented on PR #5171: URL: https://github.com/apache/arrow-datafusion/pull/5171#issuecomment-1421171267
> @mingmwang, I don't follow why you think there is a a bug in [this example](https://github.com/apache/arrow-datafusion/pull/5171#issuecomment-1420625925). The query does not specify a top level ordering, so limiting the top or bottom 5 are both fair game from a query perspective. Looking at it from a logical vs. physical plan perspective, I still do not see a problem. Order annotations in logical plan aggregations are local to them, they don't have a bearing on output ordering AFAIK. These annotations specify the frame, but that's where their scope ends. If they had any bearing on output ordering, they would have the same effect at the query level too, but they don't. The query does not specify a top level ordering explicitly, but the final result ordering is impacted by the ordering expressions in WindowExecs, I think with/without the (reverse window expr) optimization, this SQL will give different results, this is something we should avoid. -- 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: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org