spark.sql vs SqlContext

后端 未结 4 1999
盖世英雄少女心
盖世英雄少女心 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 16:50

    • Next create the df1 as javaobject

      df1=sqlcontext.sql("select col1,col2,col3 from table")
      
    • Next create df2 as DATAFRAME

      df2=spark.sql("select col1,col2,col3 from table")
      

    Check the difference using type(df2) and type(df1)

提交回复
热议问题