-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Yen Liu
committed
Aug 9, 2023
1 parent
6389651
commit cce6f0c
Showing
2 changed files
with
38 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,30 @@ | ||
package spark | ||
|
||
import driver.SparkDriver | ||
import org.apache.spark.SparkConf | ||
import org.apache.spark.sql.SparkSession | ||
|
||
object myJob1 { | ||
|
||
def main(args: Array[String]): Unit = { | ||
|
||
val conf = new SparkConf() | ||
.setAppName("myJob1") | ||
.setMaster("local[*]") | ||
|
||
//val s_driver = SparkDriver.getSparkSession("myJob1"); | ||
val s_context = SparkDriver.getSparkContext("myJob1", conf); | ||
val spark = SparkDriver | ||
|
||
//println("s_driver = " + s_driver) | ||
println("s_context = " + s_context) | ||
println("spark = " + spark) | ||
|
||
val rdd1 = s_context.makeRDD(1 to 4, 2) | ||
|
||
println(rdd1.aggregate(0)(_ + _, _ + _)) // 10 | ||
|
||
println(rdd1.aggregate(1)(_ + _, _ + _)) // 13 | ||
} | ||
|
||
} |