cloud-fan commented on code in PR #57614:
URL: https://github.com/apache/spark/pull/57614#discussion_r3705005510
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/DecorrelateInnerQuery.scala:
##########
@@ -725,9 +725,21 @@ object DecorrelateInnerQuery extends PredicateHelper {
if (partitionFields.isEmpty) {
// Underlying subquery has no predicates connecting inner and
outer query.
// In this case, limit can be computed over the inner query
directly.
+ // The ORDER BY was peeled off the Sort above; re-apply it as a
global Sort below
+ // the limit so that ORDER BY ... LIMIT (and ORDER BY ... LIMIT
... OFFSET) is
+ // order-preserving. Otherwise the ordering is dropped and the
limit returns an
+ // arbitrary (non-deterministic) row.
Review Comment:
```suggestion
// arbitrary (non-deterministic) rows.
```
--
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]