
Ultimate access to all questions.
You have a DataFrame df with a nested column profile.age. How would you cast this nested field to an integer and create a new top-level column named age using Spark? Provide the code snippet.
A
df.withColumn('age', col('profile.age').cast('int'))
B
df.select(col('profile.age').cast('int').alias('age'))
C
df.withColumn('age', 'profile.age'.cast('int'))
D
df.select('profile.age'.cast('int').alias('age'))