QuestionQ16
VerifiedTroubleshooting and Tuning Apache Spark DataFrame API Applications.A data engineer is working with a dataset that contains 2 billion rows spread across 10 Spark partitions. The engineer must compute the approximate count of distinct users by the user_id field and also calculate the average transaction_amount. Both calculations must occur in a single transformation step to minimize shuffling.
Which set of Spark code accomplishes this goal while maintaining performance?
Community Discussion