Difference between passing elements from map in spark

Free Online Certification Courses – Learn Today. Lead Tomorrow. Forums Apache Spark Difference between passing elements from map in spark

Viewing 0 reply threads
  • Author
    Posts
    • #6492
      DataFlair TeamDataFlair Team
      Spectator

      What is the difference between below two ways?

      val result = data.map { line => line.split(“\t”)(2) }
      .countByValue()
      ———————————————————————————-
      val result = data.map { line => line.split(“\t”)
      line(2)
      }.countByValue()

      Both the outputs are not matching with one another.

Viewing 0 reply threads
  • You must be logged in to reply to this topic.