-
安装Scala插件:打开IntelliJ IDEA,点击菜单栏的“File”-“Settings”(或者快捷键“Ctrl+Alt+S”),在弹出的窗口中选择“Plugins”选项。在搜索框中输入“Scala”,然后点击“Install”按钮安装Scala插件。
-
配置Scala SDK:回到“Settings”窗口,在左侧面板中选择“Build, Execution, Deployment”-“Scala Compiler”,然后点击右侧的“Configure..."按钮。在弹出的窗口中点击“New...”按钮,选择您已经安装的Scala SDK版本,并点击“OK”按钮
-
编写代码
import org.apache.spark.SparkConf
import org.apache.spark.sql.types.{StructField, _}
import org.apache.spark.sql.{Row, RowFactory, SparkSession}
import java.sql.Date
import java.util.{Properties, UUID}
object addBooster {
def main(args: Array[String]): Unit = {
val sparkConf = new SparkConf().setMaster("local[*]").setAppName("readPostgresql")
val spark = SparkSession.builder.config(sparkConf).getOrCreate()
//数据来源
val d