How do we select the first available phone number from mobile, home phone, or a fallback 'N/A' literal?
coalesce() evaluates Column arguments from left to right and returns the first non-null value.
Customer contact resolution, priority channel fallback, and merging multi-source address fields.
from pyspark.sql.functions import col, coalesce, lit
df = df.withColumn(
"contact_phone",
coalesce(col("mobile"), col("home_phone"), lit("N/A"))
)Practice typing production-grade PySpark code for First Non-Null Selection with coalesce().