[GitHub] spark pull request #13520: [SPARK-15773][CORE][EXAMPLE] Avoid creating local...
Github user asfgit closed the pull request at: https://github.com/apache/spark/pull/13520 --- 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
[GitHub] spark pull request #13520: [SPARK-15773][CORE][EXAMPLE] Avoid creating local...
Github user srowen commented on a diff in the pull request: https://github.com/apache/spark/pull/13520#discussion_r65850872 --- Diff: examples/src/main/scala/org/apache/spark/examples/GroupByTest.scala --- @@ -32,16 +32,14 @@ object GroupByTest { .appName("GroupBy Test") .getOrCreate() -var numMappers = if (args.length > 0) args(0).toInt else 2 -var numKVPairs = if (args.length > 1) args(1).toInt else 1000 -var valSize = if (args.length > 2) args(2).toInt else 1000 -var numReducers = if (args.length > 3) args(3).toInt else numMappers +val numMappers = if (args.length > 0) args(0).toInt else 2 --- End diff -- This looks unrelated. I'd rather not make unrelated changes, but, this is also clearly the right change. --- 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
[GitHub] spark pull request #13520: [SPARK-15773][CORE][EXAMPLE] Avoid creating local...
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 HyunDate: 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