Front Page Forums Apache Spark flaMap gives different output in python and scala

This topic contains 0 replies, has 1 voice, and was last updated by  dfbdteam5 2 months, 4 weeks ago.

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #6502

    dfbdteam5
    Moderator

    I’m trying to use flatMap in my code and was getting different result in spark and Scala. Below is the result which I,m getting

    scala> val x = result.flatMap {line => {val xml = XML.loadString(line); xml.attribute(“Title”) }}

    scala> x.take(2)
    res3: Array[Seq[scala.xml.Node]] = Array(How can I do simple machine learning without hard-coding behavior?, What open-source books (or other materials) provide a relatively thorough overview of data science?)

    Here I m getting array of string , while in python I am getting array of character.

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.