Question 350
A Pandas UDF emits strings but declares an integer return type; a scheduled batch fails after a new category appears. A scalar UDF silently calls an external paid service once per row, creating duplicate invoices after Spark retries tasks. A grouped Pandas UDF receives unexpectedly large groups and one executor runs out of memory while others remain idle. Which course of action addresses the stated issues?
Explanation
Correct Answer
Spark must reconcile the declared type with the values emitted across Python execution boundaries. Spark can recompute tasks, so per-row side effects are not guaranteed to run exactly once. Grouped operations may materialize the full group in Python memory rather than uniform small batches.
Incorrect Answers
Vectorized evaluation can reduce per-row Python crossing overhead when the function and types are supported; Requirement 2 requires: move external side effects out of retryable row UDF execution and design an idempotent controlled enrichment step.
Grouped operations may materialize the full group in Python memory rather than uniform small batches.
Vectorized evaluation can reduce per-row Python crossing overhead when the function and types are supported; Requirement 1 requires: align the declared UDF return type and actual output schema, then test representative null and malformed values.






Certified Data Engineer Professional Practice Tests