Hello

I searched on StackOverflow and Github issues of the Spark project but
could not find an answer.

If I have a Spark SQL query in which the ORDER BY clause is in a nested
subquery, are we guaranteed that Spark will always output sorted results?

For example, if I have a query like the following
SELECT * FROM (SELECT a, b, c FROM my_table ORDER BY a LIMIT 10) WHERE b >
50
is it guaranteed that the final output in Spark is ordered by column "a"?

I ask because in some databases, the inner ORDER BY is ignored completely (
https://stackoverflow.com/questions/16248813/is-order-in-a-subquery-guaranteed-to-be-preserved,
https://mariadb.com/kb/en/why-is-order-by-in-a-from-subquery-ignored)

Thank you
Regards
Vinay Londhe

Reply via email to