score:2

df.withcolumn("quelle",when(col("id").contains("123"),lit("xy")).otherwise("aa")) should give you the result you are looking for

i tried to reproduce the error you are getting and this is likely the one which you tried df.withcolumn("quelle",when("id".contains("123"),lit("xy")).otherwise("aa")) which gives me exactly the same error you are getting above.

error: type mismatch; found : boolean required: org.apache.spark.sql.column

please check if this helps


Related Query

More Query from same tag