Github user fhueske commented on the issue: https://github.com/apache/flink/pull/4380 Hi @rtudoran, thanks for updating the PR. I had a brief look at it and as I said before, I don't think we need additional ProcessFunctions for any of the `ORDER BY *time ASC OFFSET x FETCH y` cases. All cases (proctime and rowtime) can be implemented by extending the current functions for `ORDER BY`. All we have to do is to - add a counter for `OFFSET` and not emit the first `x` rows (counter should be stored as state) - add a counter for `FETCH` and not emit more than `y` rows (counter should be stored as state). If `OFFSET` or `FETCH` are not required, we can set `x` and/or `y` to `-1` and ignore the counters. Once we have extended the current ProcessFunctions, we can also remove the additional methods in `DataStreamSort` and `SortUtil` because we always translate to the same `ProcessFunction` just with different values for `offset` and `fetch`. So we only have to extend the current methods in `DataStreamSort` and `SortUtil` to set the correct values for `offset` and `fetch` (either the values from the query or `-1` if not used) to the updated ProcessFunctions. That should simplify the PR and require much less changes and code. Let me know what you think, Fabian
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---