QuestionQ282
VerifiedCost & Performance OptimisationA data engineer is trying to run the following PySpark code:
df = spark.read.table("sales")
result = df.groupBy("region").agg(sum("revenue"))
After reviewing the execution plan and profiling the Spark job, they find excessive data shuffling during the aggregation phase.
Which technique should be used to reduce shuffling during the groupBy aggregation operation?
Community Discussion