title: Is it possible to join a hive table with an in-memory table in Spark SQL?
body: <p>I'm learning Spark SQL, and got confused about Spark's SessionCatalog and Hive MetaStore.</p>
  
  <p>I've learned that the HiveSessionStateBuilder will create a new Analyzer with HiveSessionCatalog.</p>
  
  <p>Does that mean that we can join hive table and in-memory table in one spark sql?</p>
  
  <pre><code>/**
     * Create a [[HiveSessionCatalog]].
     */
    override protected lazy val catalog: HiveSessionCatalog = {
      val catalog = new HiveSessionCatalog(
        externalCatalog,
        session.sharedState.globalTempViewManager,
        new HiveMetastoreCatalog(session),
        functionRegistry,
        conf,
        SessionState.newHadoopConf(session.sparkContext.hadoopConfiguration, conf),
        sqlParser,
        resourceLoader)
      parentState.foreach(_.catalog.copyStateTo(catalog))
      catalog
    }
  
    /**
     * A logical query plan `Analyzer` with rules specific to Hive.
     */
    override protected def analyzer: Analyzer = new Analyzer(catalog, conf) {
      override val extendedResolutionRules: Seq[Rule[LogicalPlan]] =
        new ResolveHiveSerdeTable(session) +:
        new FindDataSourceTable(session) +:
        new ResolveSQLOnFile(session) +:
        customResolutionRules
  
      override val postHocResolutionRules: Seq[Rule[LogicalPlan]] =
        new DetermineTableStats(session) +:
        RelationConversions(conf, catalog) +:
        PreprocessTableCreation(session) +:
        PreprocessTableInsertion(conf) +:
        DataSourceAnalysis(conf) +:
        HiveAnalysis +:
        customPostHocResolutionRules
  
      override val extendedCheckRules: Seq[LogicalPlan =&gt; Unit] =
        PreWriteCheck +:
        customCheckRules
    }
  </code></pre>