To resolve this, consider:
Filtering data before applying ROW_NUMBER().
Breaking down large queries into smaller chunks.
Increasing the BigQuery slot allocation if possible.