spark.sql vs SqlContext

后端 未结 4 2029
盖世英雄少女心
盖世英雄少女心 2021-01-20 16:04

I have used SQL in Spark, in this example:

results = spark.sql(\"select * from ventas\")

where ventas is a dataframe, previosuly cataloged

4条回答
  •  甜味超标
    2021-01-20 17:00

    Sparksession is the preferred way of working with Spark object now. Both Hivecontext and SQLContext are available as a part of this single object SparkSession.

    You are using the latest syntax by creating a view df.createOrReplaceTempView('ventas').

提交回复
热议问题