QuestionQ20

VerifiedDeveloping Apache Spark™ DataFrame/DataSet API Applications

Which of the following code blocks produces a new DataFrame from storesDF in which the storeId column is of type string?

Explanation

withColumn returns a new DataFrame with the named column added or replaced. col("storeId") supplies a Column expression, and Column.cast(StringType()) converts that expression to Spark SQL's string data type.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!