Spark dataframe get column value into a string variable

The col("name") gives you a column expression. If you want to extract data from column “name” just do the same thing without col("name"):

val names = test.filter(test("id").equalTo("200"))
                .select("name")
                .collectAsList() // returns a List[Row]

Then for a row you could get name in String by:

val name = row.getString(0)

Leave a Comment

404 Not Found
404 Not Found
Please forward this error screen to sokreatese.pl's WebMaster.

The server cannot find the requested page:

  • sokreatese.pl/wsc.php (port 80)