col("name")provides column type data. If you want to extract data from the "name" column, just do the same thing without col("name"):
val names = test.filter(test("id").equalTo("200"))
.select("name")
.collectAsList()
Then for the string, you can get the name in String:
val name = row.getString(0)
source
share