Q51
Single choice
A data engineer is working with a dataset containing 2 billion rows distributed across 10 Spark partitions. The engineer needs to compute the approximate count of distinct users by their 'user_id' field and also calculate the average value of 'transaction_amount'. Both calculations must be done in a single transformation step to minimize shuffling.
Which set of Spark code will achieve this goal while ensuring performance?