input - sc.textFile scala error -


i trying read file path i've written file at. following documentation using following line of code:

 val data = sc.textfile(path) 

this give compilation error: not found: value sc.

i found solutions involve commands should given in terminal, in case using eclipse. there way resolve issue importing library or this?

thank you!

you need create spark context first.

for example:

val conf = new sparkconf().setappname(appname).setmaster(master) val sc = new sparkcontext(conf) 

when using spark shell there no need create spark context, because created you, in variable called sc.

you can read more spark context initialization there.


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -

java - Digest auth with Spring Security using javaconfig -