CERTIFIED-DATA-ANALYST-ASSOCIATE · Question #9
CERTIFIED-DATA-ANALYST-ASSOCIATE Question #9: Real Exam Question with Answer & Explanation
The correct answer is C: When custom logic needs to be applied at scale to array data objects. Higher-order functions (like transform(), filter(), and aggregate() in Spark SQL) exist specifically to apply custom logic to array-type columns at scale, without needing to explode arrays into rows and re-aggregate - making C correct. Option A is wrong because simple, unnested d
Question
In which of the following situations should a data analyst use higher-order functions?
Options
- AWhen custom logic needs to be applied to simple, unnested data
- BWhen custom logic needs to be converted to Python-native code
- CWhen custom logic needs to be applied at scale to array data objects
- DWhen built-in functions are taking too long to perform tasks
- EWhen built-in functions need to run through the Catalyst Optimizer
Explanation
Higher-order functions (like transform(), filter(), and aggregate() in Spark SQL) exist specifically to apply custom logic to array-type columns at scale, without needing to explode arrays into rows and re-aggregate - making C correct. Option A is wrong because simple, unnested data is handled efficiently by standard built-in functions with no need for higher-order variants. Option B is backwards - higher-order functions keep logic inside Spark's native execution engine, not converted to Python-native code. Option D confuses the purpose: higher-order functions solve a structural problem (operating on nested array data), not a speed problem with built-ins. Option E is a distractor because built-in functions already pass through the Catalyst Optimizer natively, so that's not a reason to switch.
Memory tip: Think "higher-order = higher complexity data." When your column contains arrays (nested/complex types) and you need custom logic applied element-by-element at scale, reach for higher-order functions.
Community Discussion
No community discussion yet for this question.