title: AnalysisException: Table or view not found --- Even after I create a view using "createGlobalTempView" , how to fix?
body: <p>I am using spark-sql-2.4.1v to streaming in my PoC.
  I am trying to do join by registering dataframes as table.</p>
  
  <p>For which I am using createGlobalTempView and doing as below</p>
  
  <pre><code> first_df.createGlobalTempView("first_tab");
   second_df.createGlobalTempView("second_tab");
  
  Dataset&lt;Row&gt; joinUpdatedRecordsDs =  sparkSession.sql("select a.* , b.create_date, b.last_update_date from first_tab as a "
          + " inner join second_tab as b "
          + " on  a.company_id = b.company_id  "
          );
  </code></pre>
  
  <blockquote>
    <p>ERROR  org.apache.spark.sql.AnalysisException: Table or view not
    found: first_tab; line 1 pos 105</p>
  </blockquote>
  
  <p>What wrong I am doing here ? how to fix this ?</p>
  
  <blockquote>
    <p>Some more info</p>
  </blockquote>
  
  <p>On my spark session I ".enableHiveSupport()" set.</p>
  
  <blockquote>
    <p>When I see logs I found these traces</p>
  </blockquote>
  
  <pre><code>19/09/13 12:40:45 WARN ObjectStore: Failed to get database global_temp, returning NoSuchObjectException
  19/09/13 12:40:45 INFO HiveMetaStore: 0: get_table : db=default tbl=first_tab
  19/09/13 12:40:45 INFO audit: ugi=userrw    ip=unknown-ip-addr  cmd=get_table : db=default tbl=first_tab    
  19/09/13 12:40:45 INFO HiveMetaStore: 0: get_table : db=default tbl=second_tab
  19/09/13 12:40:45 INFO audit: ugi=userrw    ip=unknown-ip-addr  cmd=get_table : db=default tbl=second_tab   
  19/09/13 12:40:45 INFO HiveMetaStore: 0: get_database: default
  19/09/13 12:40:45 INFO audit: ugi=userrw    ip=unknown-ip-addr  cmd=get_database: default   
  19/09/13 12:40:45 INFO HiveMetaStore: 0: get_database: default
  19/09/13 12:40:45 INFO audit: ugi=userrw    ip=unknown-ip-addr  cmd=get_database: default   
  19/09/13 12:40:45 INFO HiveMetaStore: 0: get_tables: db=default pat=*
  19/09/13 12:40:45 INFO audit: ugi=userrw    ip=unknown-ip-addr  cmd=get_tables: db=default pat=*    
  </code></pre>
  
  <blockquote>
  <pre><code>System.out.println("first_tab exists : " + sparkSession.catalog().tableExists("first_tab"));
   System.out.println("second_tab exists : " + sparkSession.catalog().tableExists("second_tab"));
  </code></pre>
  </blockquote>
  
  <p>Output</p>
  
  <pre><code>first_tab exists : false
      second_tab exists : false
  </code></pre>
  
  <blockquote>
    <p>I tried to print the tables in the db as below but nothing prints.</p>
  </blockquote>
  
  <pre><code> sparkSession.catalog().listTables().foreach( tab -&gt; {
              System.out.println("tab.database :" + tab.database());
              System.out.println("tab.name :" + tab.name());
              System.out.println("tab.tableType :" + tab.tableType());
          });
  </code></pre>
  
  <p>No output printed , therefore we may say no table created.</p>
  
  <blockquote>
    <p>I tried to create tables with "<strong>global_temp.</strong>" but throws error</p>
  </blockquote>
  
  <pre><code>org.apache.spark.sql.AnalysisException: It is not allowed to add database prefix `global_temp` for the TEMPORARY view name.;
      at org.apache.spark.sql.execution.command.CreateViewCommand.&lt;init&gt;(views.scala:122)
  </code></pre>
  
  <p>I tried to refer table with appending "<strong>global_temp.</strong>" but throws same above error</p>
  
  <p>i.e </p>
  
  <pre><code>System.out.println("first_tab exists : " + sparkSession.catalog().tableExists("global_temp.first_tab"));
   System.out.println("second_tab exists : " + sparkSession.catalog().tableExists("global_temp.second_tab"));
  </code></pre>
  
  <p>same above error</p>