Why compute row_number() order by monotonically_increasing_id() in Spark?

Viewed 18

It is suggested that you can 'generate unique increasing numeric values' by

select row_number() over (order by monotonically_increasing_id()) from /* ... */

But you can just as well do this:

select row_number() over (order by 1) from /* ... */

What benefit does using monotonically_increasing_id() provide in this case?

0 Answers
Related