HyukjinKwon commented on a change in pull request #33461:
URL: https://github.com/apache/spark/pull/33461#discussion_r674457379



##########
File path: python/pyspark/sql/catalog.py
##########
@@ -180,15 +180,37 @@ def tableExists(self, tableName, dbName=None):
 
         Examples
         --------
+
+        This function can check if a table is defined or not:
+
         >>> spark.catalog.tableExists("unexisting_table")
         False
         >>> df = spark.sql("CREATE TABLE tab1 (name STRING, age INT) USING 
parquet")
         >>> spark.catalog.tableExists("tab1")
         True
         >>> df = spark.sql("DROP TABLE tab1")
+        >>> spark.catalog.tableExists("unexisting_table")
+        False
+
+        It also works for views:
+
+        >>> spark.catalog.tableExists("view1")
+        False
+        >>> df = spark.sql("CREATE VIEW view1 AS SELECT 1")
+        >>> spark.catalog.tableExists("view1")
+        True
+        >>> df = spark.sql("DROP VIEW view1")
+        >>> spark.catalog.tableExists("view1")
+        False
+
+        And also for temporary views:

Review comment:
       ```suggestion
           And also for temporary views:
   
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to