[Solved]Scala/Spark save texts in program without save to files -


my code save val: s result.txt
, read file again
want know there method code can run directly without save file , read back.

i user val textfile = sc.parallelize(s)

but next part have error: value contains not member of char

import java.io._ val s = (r.capture("lines"))  resultpath = /home/user val pw = new printwriter(new file(f"$resultpath%s/result.txt")) pw.write(s) pw.close //val textfile = sc.textfile(f"$resultpath%s/result.txt") old method:save file , read val textfile = sc.parallelize(s)       val rows = textfile.map { line =>   !(line contains "[, 1]")   val fields = line.split("[^\\d.]+")   ((fields(0), fields(1).todouble)) } 

i have problem having variable s string data type , doing parallelize on string instead of collection. when run map function iterating on each character in string.


Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -