Understand SparkContext,SQLContext and SparkSession

Understand SparkContext,SQLContext and SparkSession

HashFlare
SparkContext

The SparkContext allows your Spark driver application to access the cluster through a resource manager. The resource manager can be YARN, or Spark’s cluster manager.

Spark SQL and DataFrame

Spark introduces a programming module for structured data processing called Spark SQL. It provides a programming abstraction called DataFrame and can act as distributed SQL query engine.

A DataFrame can be constructed from an array of different sources such as Hive tables, Structured Data files, external databases, or existing RDDs. This API was designed for modern Big Data and data science applications taking inspiration from DataFrame in R Programming and Pandas in Python.

SQLContext and SparkSession

SQLContext is a class and is used for initializing the functionalities of Spark SQL. SparkContext class object (sc) is required for initializing SQLContext class object.

In Spark 1.3.1, SparkSQL implements dataframes and a SQL query engine. SparkSQL has a SQLContext and a HiveContext.

and from Spark 2.0.0

SparkSession is introduced as the new entry point of Spark that replaces the old SQLContext and HiveContext. Note that the old SQLContext and HiveContext are kept for backward compatibility.

Spark Standalone deployment:

https://spark.apache.org/docs/latest/spark-standalone.html

Spark SQL:

https://spark.apache.org/docs/latest/sql-programming-guide.html

 

by LIU YUE

-2018.4.12

友荐云推荐

SIMILAR ARTICLES

0 498