I would like to ask Spark'DataFrame to edit only one column (intercept a paragraph) and return the new DataFrame.

ask Spark"DataFrame to edit only one column (intercept a paragraph) and return a new DataFrame

Mar.11,2021

you can map

 val session = SparkSession.builder().config(sc).getOrCreate()
    try {

      val df = session.read.json("file:\\\\\\E:/anc.json")
        .map(new MapFunction[Row, String] {
          override def call(value: Row): String = {
            value.getAs[Long]("id").toString.substring(0, 1)
          }
        }, Encoders.STRING)

      df.show()

    } finally {
      session.close()
    }
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ea7bbe-47c51.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ea7bbe-47c51.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?