原始数据
001,goods0001,10,20.00
002,goods0001,10,20.00
003,goods0002,50,30.00
004,goods0001,10,30.00
005,goods0003,90,10.00
006,goods0002,10,40.00
createOrReplaceTempView
/**
* createOrReplaceTempView:创建临时视图
* Spark SQL中的临时视图是会话范围的,如果创建它的会话终止,则会消失
*/
@Test
def test2(): Unit ={
val spark: SparkSession = SparkSession.builder().appName("Spark SQL basic example")
.config("spark.some.config.option", "some-value").getOrCreate()
import spark.implicits._