Difference between passing elements from map in spark

Viewing 0 reply threads
  • Author
    Posts
    • #6492
      DataFlair Team
      Moderator

      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.