I'm having performance issues and after checking spark's web UI i found there is a severe data skewness issue:

I have tried "distribute by" and "repartition" by multiple combinations of columns with no luck so i'm trying to debug how spark is partitioning the dataset(in order to fix it), is there any way to manually run the partitioning function for creating a column? Basically i'm trying to do something similar to:
df = df.withColumn("assigned_partition", partitioning_function())
df_grouped = df.groupby("assigned_partition").count()
So that i can identify patterns or reasons for skewness.
Note: this is right after querying hive tables, so i know the skewness is not due to any spark logic or calculations.
