
Ultimate access to all questions.
Given a DataFrame df with a column description containing strings, how would you extract the first word from this column using Spark? Provide the code snippet.
A
df.withColumn('first_word', split(col('description'), ' ')[0])_
B
df.select(split(col('description'), ' ')[0])
C
df.withColumn('first_word', substring(col('description'), 0, indexOf(col('description'), ' ')))_
D
df.select(substring(col('description'), 0, indexOf(col('description'), ' ')))