DE Mastery GitHub

Apache Spark · SPK-09

UDFs and the Pandas API

From your world. dbt Python models, and the pandas you reach for out of habit

Practice quiz with instant feedback. For a scored run that counts toward your local progress, use uv run de quiz SPK-09.

1You add a scalar Python UDF to a query and run df.explain(). Which plan node shows that a row-by-row Python round trip will happen?
2Why is a scalar Python UDF usually slower than the equivalent built-in function?
3You need custom Python logic over a numeric column, but you want to avoid BatchEvalPython. Which option transfers data as Arrow batches and shows as ArrowEvalPython?
4You want per-group logic. Each group arrives as a whole pandas.DataFrame, and you return a pandas.DataFrame. Which API is that?
5What is the main advantage of the Pandas API on Spark (import pyspark.pandas as ps) over real pandas?
6A teammate converts order amounts to USD. The teammate joins a daily fx_rates table and multiplies. Another teammate writes a Python UDF that looks up the rate for each row. Both return the same numbers. Which statement is TRUE?
7Which of these are legitimate reasons to prefer a pandas/Arrow UDF over a plain Python UDF? (select all) (select all that apply)