I resolved it using the function monotonically_increasing_id and a little logic to set the Column Name.
To do this is necessary Java 1.8, because raise a error on function 'collect()' in Java 11.
df = df.withColumn('index', F.monotonically_increasi...