- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Tutorial Exercise 3 - not found: value sc
- Labels:
-
Quickstart VM
Created ‎08-21-2018 01:54 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The Scala code in this exercise does not compile:
https://www.cloudera.com/developers/get-started-with-hadoop-tutorial/exercise-3.html
I get the error:
<console>:30: error: not found: value sc
return sc.newAPIHadoopRDD(job.getConfiguration,
Where is the variable 'sc' initialized? There are many errors in these tutorials which is a bit frustrating, I hope someone can tell me how to overcome it, thanks.
I am running the latest CDH Quickstart docker image.
Created ‎08-21-2018 04:32 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You have to initialize sc depends upon how you are executing your code. If you are using spark-shell command line then you don't need to initilize sc as it will be initialized by default when you login but if you are developing code in other 3rd party tools and executing then you have to initilialize as follows:
You can add the below lines before you call rddFromParquetHdfsFile
import org.apache.spark.SparkConf
import org.apache.spark.SparkContext
val conf = new SparkConf().setAppName("your topic").setMaster("yarn-client")
val sc = new SparkContext(conf)
