After you set the auto import for idea, some automatic import scenarios and their descriptions are written when you write the spark application.
1. Automatic import of ordinary class
var cnames = new Arraybuffer[string] () var ips = new Arraybuffer[string] ()
Arraybuffer class package can be imported directly according to the prompt alt+enter
2. Need to implicitly convert
val Joinrdd = reqrdd.join (Resprdd) . map (x = (x._2._1, x._2._2)) . reducebykey ((x, y) = x)
Joinrdd. collect. foreach (println)
You need to import statements at this time
import org .apache .spark ._
Manual import required, personal understanding: Here the Reducebykey method does not determine which class it belongs to in idea, so it is not possible to give hints about which class to import.
You need to put the implicit conversion into scope before the type is converted.
Idea's auto import and Scala's implicit conversion