HI ALL: I don't quite understand the different between : dataframe.foreach and dataframe.collect().foreach . When to use dataframe.foreach?
I use spark2.0 ,I want to iterate a dataframe to get one colum's value : this can work out blacklistDF.collect().foreach { x => println(s">>>>>>>getString(0)" + x.getAs[String]("uid")) val put = new Put(Bytes.toBytes(x.getAs[String]("uid"))); put.add(Bytes.toBytes("cf"), Bytes.toBytes("uid"), Bytes.toBytes(x.getAs[String]("uid"))) hrecords.add(put) } if I use blacklistDF.foreach {....} I will get nothing