damccorm commented on code in PR #38832:
URL: https://github.com/apache/beam/pull/38832#discussion_r3365237773
##########
sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/rel/BeamSortRel.java:
##########
@@ -209,6 +207,20 @@ public PCollection<Row> expand(PCollectionList<Row>
pinput) {
GlobalWindows.class.getSimpleName(), windowingStrategy));
}
+ // When no limit is specified (count == -1), we must sort the entire
dataset.
+ // To achieve this globally, we key all rows by a single dummy key,
group them together
+ // using GroupByKey to ensure they are processed together, and then
sort them in-memory
+ // via SortInMemoryFn. Note: This can be memory-intensive for large
datasets.
Review Comment:
```suggestion
// via SortInMemoryFn. Note: This can be memory-intensive for large
datasets. It should
// only be done as a final step when the remaining data is small
```
--
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]