stephanecollot commented on pull request #27861:
URL: https://github.com/apache/spark/pull/27861#issuecomment-879238130


   Hi
   
   I'm interested in this, I want to give a row number per group, without 
sorting for performance reason and because I don't mind about the order. 
   
   Here: 
https://stackoverflow.com/questions/53042432/creating-a-row-number-of-each-row-in-pyspark-dataframe-using-row-number-functi
   
   Some one suggests to put a dummy value:
   ```
   from pyspark.sql.functions import row_number,lit
   from pyspark.sql.window import Window
   w = Window().orderBy(lit('A'))
   df = df.withColumn("row_num", row_number().over(w))
   ```
   But I assume it is still doing the comparison, and having a performance 
impact right?
   
   Cheers


-- 
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]

Reply via email to