title: Check if table exists in hive metastore using Pyspark
body: <p>I am trying to check if a table exists in hive metastore if not, create the table. And if the table exists, append data.</p>
  <p>I have a snippet of the code below:</p>
  <pre class="lang-py prettyprint-override"><code>spark.catalog.setCurrentDatabase(&quot;db_name&quot;)
  db_catalog = spark.catalog.listTables(dbName = 'table_name)
  if any(table_name in row for row in db_catalog):
      add data
  else:
      create table
  </code></pre>
  <p>However, I am getting an error.</p>
  <pre class="lang-py prettyprint-override"><code>&gt;&gt;&gt; ValueError: Some of types cannot be determined after inferring
  </code></pre>
  <p>I am unable to resolve the value error as I get the same errors for other databases' tables created in hive metastore. Is there another way to check if table exists in hive metastore?</p>