spark-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Reynold Xin (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (SPARK-15773) Avoid creating local variable `sc` in examples if possible
Date Fri, 10 Jun 2016 22:41:21 GMT

     [ https://issues.apache.org/jira/browse/SPARK-15773?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Reynold Xin resolved SPARK-15773.
---------------------------------
       Resolution: Fixed
         Assignee: Dongjoon Hyun
    Fix Version/s: 2.0.0

> Avoid creating local variable `sc` in examples if possible
> ----------------------------------------------------------
>
>                 Key: SPARK-15773
>                 URL: https://issues.apache.org/jira/browse/SPARK-15773
>             Project: Spark
>          Issue Type: Task
>          Components: Examples
>            Reporter: Dongjoon Hyun
>            Assignee: Dongjoon Hyun
>            Priority: Minor
>             Fix For: 2.0.0
>
>
> Instead of using local variable `sc` like the following example, this issue uses `spark.sparkContext`.
This makes examples more concise, and also fixes some misleading, i.e., creating SparkContext
from SparkSession.
> {code}
> -    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)
> {code}
> This will change 12 files (+30 lines, -52 lines).



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org


Mime
View raw message