lyne7-sc opened a new issue, #27653: URL: https://github.com/apache/datafusion/issues/27653
### Describe the bug With the join ordering fix in #25053, an inner hash join with an unbounded probe input can introduce a `PartialSortExec` for `ORDER BY probe.k, build.v LIMIT 1`. The partial sort waits for the current probe-key group to end before emitting a row. If the probe emits rows for one key and then stays pending, the query can wait indefinitely for its first row. Before the fix, the reported reproduction returned immediately. ### To Reproduce Use a bounded build input with rows `(1, 100)` and `(2, 200)` that advertises `PRIMARY KEY(k)` and output ordering `(k, v)`. Use an unbounded probe input ordered by `k` that emits several rows with `k = 1` and then stays pending without closing the stream. With these inputs on the build and probe sides of an inner hash join, request the following query: ```sql SELECT probe.k, build.v FROM build JOIN probe ON build.k = probe.k ORDER BY probe.k, build.v LIMIT 1; ``` In the reported physical-plan reproduction, the plan before #25053 returns `(1, 100)` immediately. With the fix, the plan adds a `PartialSortExec` with a one-column ordering prefix and times out waiting for the first row. The SQL illustrates the query for the physical inputs described above. ### Expected behavior The query returns `(1, 100)` without waiting for another probe key or for the stream to end. The build primary key ensures every probe row with `k = 1` matches the same build row, so `build.v` is constant within that group. ### Additional context Follow-up to #25053. ### Willingness to contribute None -- 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]
