Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between SparkSession.catalog and SparkSession.sessionState.catalog?

I'm learning Spark, got confused about Spark's Catalog.

I found a catalog in SparkSession, which is an instance of CatalogImpl, as below

  /**
   * Interface through which the user may create, drop, alter or query underlying
   * databases, tables, functions etc.
   *
   * @since 2.0.0
   */
  @transient lazy val catalog: Catalog = new CatalogImpl(self)

And I found that there is a catalog in SparkSession.sessionState, which is an instance of SessionCatalog.

What's the difference between them?

like image 280
lulijun Avatar asked Nov 26 '25 17:11

lulijun


1 Answers

What's the difference between them?

tl;dr None.


The line in CatalogImpl is the missing piece in your understanding:

private def sessionCatalog: SessionCatalog = sparkSession.sessionState.catalog

In other words, SparkSession.catalog creates a CatalogImpl that uses sparkSession.sessionState.catalog under the covers.

like image 185
Jacek Laskowski Avatar answered Nov 28 '25 16:11

Jacek Laskowski



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!