spark版hello word
import org.apache.spark.SparkContext import org.apache.spark.SparkContext._ import org.apache.spark.SparkConf object WordCount { def main(args: Array[String]) { val inputFile = "/Users/artefact/software/spark-3.1.3-bin-hadoop3.2/data/wordcount.txt" val conf = new SparkConf().setAppName("WordCount").setMaster("local") val sc = new SparkContext(conf) val textFile = sc.textFile(inputFile) val wordCount = textFile .flatMap(_.split(" ")) //.flat...
idea 配置 scala 2.12 spark 3.0.2 开发环境
基本开发环境 下载对应包 maven:https://mvnrepository.com/search?q=spark spark:http://spark.apache.org/downloads.html scala:https://www.scala-lang.org/download/2.12.12.html 注意 spark 3 使用的版本是 scala 2.12.* java:https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html 编译器配置 下载scala 插件 工程构建 配置scala 插件 构建scala 本地jar 包工程 file -》 project structure -》 添加下载的spark 中的jar 包 代码: import org.apache.spark.SparkContext ...