GitHub user dongjoon-hyun opened a pull request: https://github.com/apache/spark/pull/13520
[SPARK-15773][CORE][EXAMPLE] Avoid creating local variable `sc` in examples if possible ## What changes were proposed in this pull request? Instead of using local variable `sc` like the following example, this PR uses `spark.sparkContext`. This makes examples more concise, and also fixes some misleading, i.e., creating SparkContext from SparkSession. ``` - println("Creating SparkContext") - val sc = spark.sparkContext - println("Writing local file to DFS") val dfsFilename = dfsDirPath + "/dfs_read_write_test" - val fileRDD = sc.parallelize(fileContents) + val fileRDD = spark.sparkContext.parallelize(fileContents) ``` This will change 12 files (+30 lines, -52 lines). ## How was this patch tested? Manual. You can merge this pull request into a Git repository by running: $ git pull https://github.com/dongjoon-hyun/spark SPARK-15773 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/spark/pull/13520.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #13520 ---- commit 0a5d82fc8c1b3e0910231060090181e143e5215a Author: Dongjoon Hyun <dongj...@apache.org> Date: 2016-06-05T21:42:42Z [SPARK-15773][CORE][EXAMPLE] Avoid creating local variable `sc` in examples if possible ---- --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org