
Ultimate access to all questions.
Identify the error in the following code snippet intended to transform the productCategories column (containing arrays of strings) into individual rows with one word per row, and explain how to fix it:
storesDF.withColumn("productCategories", split(col("productCategories")))
storesDF.withColumn("productCategories", split(col("productCategories")))
Given this sample of storesDF:
storeId | productCategories
------- | -----------------
0 | [netus, pellentes...]
1 | [consequat enim,...]
2 | [massa, a, vitae,...]
3 | [aliquam, donec...]
4 | [condimentum, fer...]
5 | [viverra habitan...]
storeId | productCategories
------- | -----------------
0 | [netus, pellentes...]
1 | [consequat enim,...]
2 | [massa, a, vitae,...]
3 | [aliquam, donec...]
4 | [condimentum, fer...]
5 | [viverra habitan...]
A
The split() operation does not accomplish the requested task in the way that it is used. It should be used provided an alias.
B
The split() operation does not accomplish the requested task. The broadcast() operation should be used instead.
C
The split() operation does not accomplish the requested task in the way that it is used. It should be used as a column object method instead.
D
The split() operation does not accomplish the requested task. The explode() operation should be used instead.
E
The split() operation does not accomplish the requested task. The array_distinct() operation should be used instead.