Prefer a built-in expression
Built-in functions operate on Spark columns and give the optimizer more information than opaque custom code. upper changes customer names to uppercase without a Python callback per row. Built-ins are a good first choice when they express the required logic; measure real workloads rather than assuming a universal speedup.