You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/07/21 11:59:20 UTC
[GitHub] [spark] HyukjinKwon commented on a change in pull request #33461: [SPARK-36243] Additional unit tests for pyspark tableExists
HyukjinKwon commented on a change in pull request #33461:
URL: https://github.com/apache/spark/pull/33461#discussion_r673908232
##########
File path: python/pyspark/sql/catalog.py
##########
@@ -185,6 +185,14 @@ def tableExists(self, tableName, dbName=None):
>>> df = spark.sql("CREATE TABLE tab1 (name STRING, age INT) USING parquet")
>>> spark.catalog.tableExists("tab1")
True
+ >>> spark.catalog.tableExists("view1")
Review comment:
Since we're improving the doc tests here, shall we make it more readable? e.g.)
```
Examples
----------
The example below checks if 'unexisting_table' table.
>>> spark.sql("CREATE TABLE tab1 (name STRING, age INT) USING parquet")
>>> spark.catalog.tableExists("tab1")
True
>>> spark.sql("DROP TABLE tab1")
>>> spark.catalog.tableExists("unexisting_table")
False
This function can check if a view is defined or not:
>>> df = spark.sql("CREATE VIEW view1 AS SELECT * FROM tab1")
>>> spark.catalog.tableExists("view1")
True
>>> df = spark.sql("DROP VIEW view1")
>>> spark.catalog.tableExists("view1")
False
```
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org