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 09:58:18 UTC

[GitHub] [spark] dominikgehl opened a new pull request #33461: [SPARK-36243] Additional unit tests for pyspark tableExists

dominikgehl opened a new pull request #33461:
URL: https://github.com/apache/spark/pull/33461


   
   ### What changes were proposed in this pull request?
   Additional tests for pyspark tableExists with regard to views and temporary views
   
   
   ### Why are the changes needed?
   scala documentation indicates that tableExists works for tables/view and also temporary views. This unit tests try to verify that claim. While views seem ok, temporary views don't seem to work. 
   
   
   ### Does this PR introduce _any_ user-facing change?
   No
   
   
   ### How was this patch tested?
   tests
   


-- 
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


[GitHub] [spark] SparkQA commented on pull request #33461: [SPARK-36243][SQL][PYTHON][DOCS] Fixing pyspark tableExists issue with temporary views

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884809023


   Kubernetes integration test starting
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/45999/
   


-- 
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


[GitHub] [spark] SparkQA commented on pull request #33461: [SPARK-36243][SQL][PYTHON][DOCS] Fixing pyspark tableExists issue with temporary views

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884788582


   Kubernetes integration test unable to build dist.
   
   exiting with code: 1
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/46000/
   


-- 
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


[GitHub] [spark] SparkQA commented on pull request #33461: [SPARK-36243][PYTHON][DOCS] Fixing pyspark tableExists issue with temporary views

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884468092


   **[Test build #141415 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/141415/testReport)** for PR 33461 at commit [`474f695`](https://github.com/apache/spark/commit/474f695d7c9a29b87e370d12b4db4ad6de34b445).
    * This patch **fails Spark unit tests**.
    * This patch merges cleanly.
    * This patch adds no public classes.


-- 
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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #33461: [SPARK-36243] Additional unit tests for pyspark tableExists

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884097463






-- 
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


[GitHub] [spark] SparkQA commented on pull request #33461: [SPARK-36243][PYTHON][DOCS] Additional unit tests for pyspark tableExists

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884143968


   Kubernetes integration test starting
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/45925/
   


-- 
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


[GitHub] [spark] SparkQA removed a comment on pull request #33461: [SPARK-36243][PYTHON][DOCS] Fixing pyspark tableExists issue with temporary views

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884213806


   **[Test build #141414 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/141414/testReport)** for PR 33461 at commit [`9d3660a`](https://github.com/apache/spark/commit/9d3660a7b3254ac76daad11d5d4b535cf7d4a7d5).


-- 
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


[GitHub] [spark] SparkQA commented on pull request #33461: [SPARK-36243][SQL][PYTHON][DOCS] Fixing pyspark tableExists issue with temporary views

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884681107


   **[Test build #141474 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/141474/testReport)** for PR 33461 at commit [`ffaae01`](https://github.com/apache/spark/commit/ffaae01af281a6dd724648d62bfd49c29c845cf6).


-- 
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


[GitHub] [spark] AmplabJenkins commented on pull request #33461: [SPARK-36243] Additional unit tests for pyspark tableExists

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884097463






-- 
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


[GitHub] [spark] SparkQA commented on pull request #33461: [SPARK-36243][PYTHON][DOCS] Additional unit tests for pyspark tableExists

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884264318


   Kubernetes integration test starting
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/45931/
   


-- 
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


[GitHub] [spark] SparkQA commented on pull request #33461: [SPARK-36243][PYTHON][DOCS] Additional unit tests for pyspark tableExists

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884167270


   Kubernetes integration test status success
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/45925/
   


-- 
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


[GitHub] [spark] SparkQA commented on pull request #33461: [SPARK-36243][SQL][PYTHON][DOCS] Fixing pyspark tableExists issue with temporary views

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884756654


   **[Test build #141482 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/141482/testReport)** for PR 33461 at commit [`ffaae01`](https://github.com/apache/spark/commit/ffaae01af281a6dd724648d62bfd49c29c845cf6).
    * This patch passes all tests.
    * This patch merges cleanly.
    * This patch adds no public classes.


-- 
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


[GitHub] [spark] dominikgehl commented on a change in pull request #33461: [SPARK-36243][SQL][PYTHON][DOCS] Fixing pyspark tableExists issue with temporary views

Posted by GitBox <gi...@apache.org>.
dominikgehl commented on a change in pull request #33461:
URL: https://github.com/apache/spark/pull/33461#discussion_r678054075



##########
File path: python/pyspark/sql/catalog.py
##########
@@ -180,15 +180,38 @@ 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:
+
+        >>> df = spark.sql("CREATE TEMPORARY VIEW view1 AS SELECT 1")
+        >>> spark.catalog.tableExists("view1")
+        True
+        >>> df = spark.sql("DROP VIEW view1")
+        >>> spark.catalog.tableExists("view1")
+        False
         """
-        if dbName is None:
-            dbName = self.currentDatabase()

Review comment:
       The scala documentation specifies 
   https://github.com/apache/spark/blob/master/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/SessionCatalog.scala#L955-L956




-- 
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


[GitHub] [spark] SparkQA removed a comment on pull request #33461: [SPARK-36243] Additional unit tests for pyspark tableExists

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884098006


   **[Test build #141408 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/141408/testReport)** for PR 33461 at commit [`762b891`](https://github.com/apache/spark/commit/762b891d43ee24c8aa0b76443db773b5b4938cdb).


-- 
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


[GitHub] [spark] HyukjinKwon commented on a change in pull request #33461: [SPARK-36243] Additional unit tests for pyspark tableExists

Posted by GitBox <gi...@apache.org>.
HyukjinKwon commented on a change in pull request #33461:
URL: https://github.com/apache/spark/pull/33461#discussion_r673908815



##########
File path: python/pyspark/sql/tests/test_catalog.py
##########
@@ -210,17 +210,34 @@ def test_list_columns(self):
 
     def test_table_exists(self):
         # SPARK-36176: testing that table_exists returns correct boolean
+        from pyspark.sql.catalog import Table

Review comment:
       Let's leave the tests as is since the doctests cover it - I think it's too much




-- 
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


[GitHub] [spark] dominikgehl commented on a change in pull request #33461: [SPARK-36243][PYTHON][DOCS] Additional unit tests for pyspark tableExists

Posted by GitBox <gi...@apache.org>.
dominikgehl commented on a change in pull request #33461:
URL: https://github.com/apache/spark/pull/33461#discussion_r673988284



##########
File path: python/pyspark/sql/tests/test_catalog.py
##########
@@ -210,17 +210,34 @@ def test_list_columns(self):
 
     def test_table_exists(self):
         # SPARK-36176: testing that table_exists returns correct boolean
+        from pyspark.sql.catalog import Table

Review comment:
       Added Scala tests showing the issue




-- 
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


[GitHub] [spark] AmplabJenkins commented on pull request #33461: [SPARK-36243][PYTHON][DOCS] Fixing pyspark tableExists issue with temporary views

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884469740


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/141415/
   


-- 
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


[GitHub] [spark] SparkQA commented on pull request #33461: [SPARK-36243][PYTHON][DOCS] Fixing pyspark tableExists issue with temporary views

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884303059


   **[Test build #141423 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/141423/testReport)** for PR 33461 at commit [`a11ddc2`](https://github.com/apache/spark/commit/a11ddc2e6eb03c345bc6e7e1dafae100bda8cfe2).


-- 
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


[GitHub] [spark] SparkQA commented on pull request #33461: [SPARK-36243][PYTHON][DOCS] Fixing pyspark tableExists issue with temporary views

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884307972


   Kubernetes integration test status success
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/45932/
   


-- 
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


[GitHub] [spark] dominikgehl commented on a change in pull request #33461: [SPARK-36243][PYTHON][DOCS] Additional unit tests for pyspark tableExists

Posted by GitBox <gi...@apache.org>.
dominikgehl commented on a change in pull request #33461:
URL: https://github.com/apache/spark/pull/33461#discussion_r673912327



##########
File path: python/pyspark/sql/tests/test_catalog.py
##########
@@ -210,17 +210,34 @@ def test_list_columns(self):
 
     def test_table_exists(self):
         # SPARK-36176: testing that table_exists returns correct boolean
+        from pyspark.sql.catalog import Table

Review comment:
       @HyukjinKwon Actually, the last test here currently fails, which is why I added it. The test shows that while a temporary view gets correctly reported in listTables, it doesn't return true using tableExists. Now, I'm not sure if there's someone on the scala side who might have more insights into why this is happening and/or whether the scala documentation is outdated stating that temporary views are ok for tableExists




-- 
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


[GitHub] [spark] HyukjinKwon commented on a change in pull request #33461: [SPARK-36243] Additional unit tests for pyspark tableExists

Posted by GitBox <gi...@apache.org>.
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


[GitHub] [spark] SparkQA commented on pull request #33461: [SPARK-36243][PYTHON][DOCS] Fixing pyspark tableExists issue with temporary views

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884308931


   **[Test build #141423 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/141423/testReport)** for PR 33461 at commit [`a11ddc2`](https://github.com/apache/spark/commit/a11ddc2e6eb03c345bc6e7e1dafae100bda8cfe2).
    * This patch **fails to build**.
    * This patch merges cleanly.
    * This patch adds no public classes.


-- 
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


[GitHub] [spark] SparkQA commented on pull request #33461: [SPARK-36243] Additional unit tests for pyspark tableExists

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884095117


   Kubernetes integration test unable to build dist.
   
   exiting with code: 1
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/45919/
   


-- 
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


[GitHub] [spark] AmplabJenkins commented on pull request #33461: [SPARK-36243][PYTHON][DOCS] Fixing pyspark tableExists issue with temporary views

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884392729


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/45941/
   


-- 
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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #33461: [SPARK-36243][SQL][PYTHON][DOCS] Fixing pyspark tableExists issue with temporary views

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884696495


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/141474/
   


-- 
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


[GitHub] [spark] SparkQA commented on pull request #33461: [SPARK-36243][PYTHON][DOCS] Additional unit tests for pyspark tableExists

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884220270


   **[Test build #141415 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/141415/testReport)** for PR 33461 at commit [`474f695`](https://github.com/apache/spark/commit/474f695d7c9a29b87e370d12b4db4ad6de34b445).


-- 
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


[GitHub] [spark] SparkQA commented on pull request #33461: [SPARK-36243] Additional unit tests for pyspark tableExists

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884059592


   **[Test build #141401 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/141401/testReport)** for PR 33461 at commit [`18e0efc`](https://github.com/apache/spark/commit/18e0efcf61be3715646e06addedb2cc3fe87fa3f).


-- 
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


[GitHub] [spark] AmplabJenkins commented on pull request #33461: [SPARK-36243][PYTHON][DOCS] Fixing pyspark tableExists issue with temporary views

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884381141


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/141414/
   


-- 
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


[GitHub] [spark] AmplabJenkins commented on pull request #33461: [SPARK-36243] Additional unit tests for pyspark tableExists

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884109014


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/141408/
   


-- 
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


[GitHub] [spark] SparkQA commented on pull request #33461: [SPARK-36243][PYTHON][DOCS] Fixing pyspark tableExists issue with temporary views

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884363580


   Kubernetes integration test starting
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/45941/
   


-- 
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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #33461: [SPARK-36243][SQL][PYTHON][DOCS] Fixing pyspark tableExists issue with temporary views

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884833889


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/45999/
   


-- 
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


[GitHub] [spark] SparkQA commented on pull request #33461: [SPARK-36243][SQL][PYTHON][DOCS] Fixing pyspark tableExists issue with temporary views

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884679671


   **[Test build #141473 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/141473/testReport)** for PR 33461 at commit [`0d03776`](https://github.com/apache/spark/commit/0d037763e71a0125e0eef2171f870ccb474e10d4).


-- 
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


[GitHub] [spark] SparkQA commented on pull request #33461: [SPARK-36243][SQL][PYTHON][DOCS] Fixing pyspark tableExists issue with temporary views

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884833872


   Kubernetes integration test status success
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/45999/
   


-- 
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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #33461: [SPARK-36243][SQL][PYTHON][DOCS] Fixing pyspark tableExists issue with temporary views

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884937101


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/141473/
   


-- 
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


[GitHub] [spark] AmplabJenkins commented on pull request #33461: [SPARK-36243][PYTHON][DOCS] Fixing pyspark tableExists issue with temporary views

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884302192


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/45931/
   


-- 
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


[GitHub] [spark] SparkQA removed a comment on pull request #33461: [SPARK-36243][PYTHON][DOCS] Fixing pyspark tableExists issue with temporary views

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884303059


   **[Test build #141423 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/141423/testReport)** for PR 33461 at commit [`a11ddc2`](https://github.com/apache/spark/commit/a11ddc2e6eb03c345bc6e7e1dafae100bda8cfe2).


-- 
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


[GitHub] [spark] dominikgehl commented on a change in pull request #33461: [SPARK-36243][SQL][PYTHON][DOCS] Fixing pyspark tableExists issue with temporary views

Posted by GitBox <gi...@apache.org>.
dominikgehl commented on a change in pull request #33461:
URL: https://github.com/apache/spark/pull/33461#discussion_r678054075



##########
File path: python/pyspark/sql/catalog.py
##########
@@ -180,15 +180,38 @@ 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:
+
+        >>> df = spark.sql("CREATE TEMPORARY VIEW view1 AS SELECT 1")
+        >>> spark.catalog.tableExists("view1")
+        True
+        >>> df = spark.sql("DROP VIEW view1")
+        >>> spark.catalog.tableExists("view1")
+        False
         """
-        if dbName is None:
-            dbName = self.currentDatabase()

Review comment:
       The scala documentation specifies https://github.com/apache/spark/blob/master/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/SessionCatalog.scala#L955-L956




-- 
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


[GitHub] [spark] SparkQA removed a comment on pull request #33461: [SPARK-36243][SQL][PYTHON][DOCS] Fixing pyspark tableExists issue with temporary views

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884679671


   **[Test build #141473 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/141473/testReport)** for PR 33461 at commit [`0d03776`](https://github.com/apache/spark/commit/0d037763e71a0125e0eef2171f870ccb474e10d4).


-- 
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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #33461: [SPARK-36243][PYTHON][DOCS] Fixing pyspark tableExists issue with temporary views

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884392729


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/45941/
   


-- 
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


[GitHub] [spark] dominikgehl commented on a change in pull request #33461: [SPARK-36243][SQL][PYTHON][DOCS] Fixing pyspark tableExists issue with temporary views

Posted by GitBox <gi...@apache.org>.
dominikgehl commented on a change in pull request #33461:
URL: https://github.com/apache/spark/pull/33461#discussion_r678054075



##########
File path: python/pyspark/sql/catalog.py
##########
@@ -180,15 +180,38 @@ 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:
+
+        >>> df = spark.sql("CREATE TEMPORARY VIEW view1 AS SELECT 1")
+        >>> spark.catalog.tableExists("view1")
+        True
+        >>> df = spark.sql("DROP VIEW view1")
+        >>> spark.catalog.tableExists("view1")
+        False
         """
-        if dbName is None:
-            dbName = self.currentDatabase()

Review comment:
       The scala documentation specifies
   
   https://github.com/apache/spark/blob/master/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/SessionCatalog.scala#L955-L956

##########
File path: python/pyspark/sql/catalog.py
##########
@@ -180,15 +180,38 @@ 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:
+
+        >>> df = spark.sql("CREATE TEMPORARY VIEW view1 AS SELECT 1")
+        >>> spark.catalog.tableExists("view1")
+        True
+        >>> df = spark.sql("DROP VIEW view1")
+        >>> spark.catalog.tableExists("view1")
+        False
         """
-        if dbName is None:
-            dbName = self.currentDatabase()

Review comment:
       The scala documentation specifies
   
   
   https://github.com/apache/spark/blob/master/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/SessionCatalog.scala#L955-L956




-- 
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


[GitHub] [spark] dominikgehl commented on a change in pull request #33461: [SPARK-36243][SQL][PYTHON][DOCS] Fixing pyspark tableExists issue with temporary views

Posted by GitBox <gi...@apache.org>.
dominikgehl commented on a change in pull request #33461:
URL: https://github.com/apache/spark/pull/33461#discussion_r674525636



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/execution/SQLViewTestSuite.scala
##########
@@ -381,6 +381,21 @@ class LocalTempViewTestSuite extends SQLViewTestSuite with SharedSparkSession {
   override protected def tableIdentifier(viewName: String): TableIdentifier = {
     TableIdentifier(viewName)
   }
+
+  test("SPARK-36243: tableExists should report correctly on temporary view") {
+    Seq(true, false).foreach { storeAnalyzed =>
+      withSQLConf(STORE_ANALYZED_PLAN_FOR_VIEW.key -> storeAnalyzed.toString) {
+        val tblIdent = tableIdentifier("v")
+        assert(!spark.sessionState.catalog.tableExists(tblIdent))
+        val viewName = createView("v", "SELECT 1")
+        withView(viewName) {
+          assert(spark.sessionState.catalog.isTempView(tableIdentifier("v")))

Review comment:
       I removed the scala tests since they didn't really have much to do with the issue




-- 
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


[GitHub] [spark] SparkQA commented on pull request #33461: [SPARK-36243][SQL][PYTHON][DOCS] Fixing pyspark tableExists issue with temporary views

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884727216


   Kubernetes integration test status success
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/45991/
   


-- 
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


[GitHub] [spark] SparkQA commented on pull request #33461: [SPARK-36243][PYTHON][DOCS] Fixing pyspark tableExists issue with temporary views

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884294686


   Kubernetes integration test status success
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/45931/
   


-- 
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


[GitHub] [spark] AmplabJenkins commented on pull request #33461: [SPARK-36243][SQL][PYTHON][DOCS] Fixing pyspark tableExists issue with temporary views

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884937101


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/141473/
   


-- 
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


[GitHub] [spark] dominikgehl commented on a change in pull request #33461: [SPARK-36243][SQL][PYTHON][DOCS] Fixing pyspark tableExists issue with temporary views

Posted by GitBox <gi...@apache.org>.
dominikgehl commented on a change in pull request #33461:
URL: https://github.com/apache/spark/pull/33461#discussion_r678054075



##########
File path: python/pyspark/sql/catalog.py
##########
@@ -180,15 +180,38 @@ 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:
+
+        >>> df = spark.sql("CREATE TEMPORARY VIEW view1 AS SELECT 1")
+        >>> spark.catalog.tableExists("view1")
+        True
+        >>> df = spark.sql("DROP VIEW view1")
+        >>> spark.catalog.tableExists("view1")
+        False
         """
-        if dbName is None:
-            dbName = self.currentDatabase()

Review comment:
       The scala documentation specifies 
   [https://github.com/apache/spark/blob/master/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/SessionCatalog.scala#L955-L956](url)`

##########
File path: python/pyspark/sql/catalog.py
##########
@@ -180,15 +180,38 @@ 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:
+
+        >>> df = spark.sql("CREATE TEMPORARY VIEW view1 AS SELECT 1")
+        >>> spark.catalog.tableExists("view1")
+        True
+        >>> df = spark.sql("DROP VIEW view1")
+        >>> spark.catalog.tableExists("view1")
+        False
         """
-        if dbName is None:
-            dbName = self.currentDatabase()

Review comment:
       The scala documentation specifies 
   [https://github.com/apache/spark/blob/master/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/SessionCatalog.scala#L955-L956]




-- 
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


[GitHub] [spark] AmplabJenkins commented on pull request #33461: [SPARK-36243][PYTHON][DOCS] Fixing pyspark tableExists issue with temporary views

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884380420


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/45942/
   


-- 
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


[GitHub] [spark] AmplabJenkins commented on pull request #33461: [SPARK-36243][SQL][PYTHON][DOCS] Fixing pyspark tableExists issue with temporary views

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884727257


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/45991/
   


-- 
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


[GitHub] [spark] SparkQA commented on pull request #33461: [SPARK-36243][PYTHON][DOCS] Additional unit tests for pyspark tableExists

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884213806


   **[Test build #141414 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/141414/testReport)** for PR 33461 at commit [`9d3660a`](https://github.com/apache/spark/commit/9d3660a7b3254ac76daad11d5d4b535cf7d4a7d5).


-- 
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


[GitHub] [spark] HyukjinKwon commented on pull request #33461: [SPARK-36243][SQL][PYTHON][DOCS] Fixing pyspark tableExists issue with temporary views

Posted by GitBox <gi...@apache.org>.
HyukjinKwon commented on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884729218


   Jenkins, retest this please


-- 
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


[GitHub] [spark] SparkQA commented on pull request #33461: [SPARK-36243] Additional unit tests for pyspark tableExists

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884098006


   **[Test build #141408 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/141408/testReport)** for PR 33461 at commit [`762b891`](https://github.com/apache/spark/commit/762b891d43ee24c8aa0b76443db773b5b4938cdb).


-- 
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


[GitHub] [spark] SparkQA commented on pull request #33461: [SPARK-36243][SQL][PYTHON][DOCS] Fixing pyspark tableExists issue with temporary views

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884689395


   **[Test build #141474 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/141474/testReport)** for PR 33461 at commit [`ffaae01`](https://github.com/apache/spark/commit/ffaae01af281a6dd724648d62bfd49c29c845cf6).
    * This patch **fails PySpark unit tests**.
    * This patch merges cleanly.
    * This patch adds no public classes.


-- 
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


[GitHub] [spark] SparkQA commented on pull request #33461: [SPARK-36243][PYTHON][DOCS] Fixing pyspark tableExists issue with temporary views

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884392650


   Kubernetes integration test status success
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/45941/
   


-- 
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


[GitHub] [spark] SparkQA commented on pull request #33461: [SPARK-36243][PYTHON][DOCS] Fixing pyspark tableExists issue with temporary views

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884378220


   Kubernetes integration test unable to build dist.
   
   exiting with code: 1
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/45942/
   


-- 
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


[GitHub] [spark] SparkQA removed a comment on pull request #33461: [SPARK-36243][SQL][PYTHON][DOCS] Fixing pyspark tableExists issue with temporary views

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884730775


   **[Test build #141482 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/141482/testReport)** for PR 33461 at commit [`ffaae01`](https://github.com/apache/spark/commit/ffaae01af281a6dd724648d62bfd49c29c845cf6).


-- 
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


[GitHub] [spark] SparkQA commented on pull request #33461: [SPARK-36243][SQL][PYTHON][DOCS] Fixing pyspark tableExists issue with temporary views

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884730775


   **[Test build #141482 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/141482/testReport)** for PR 33461 at commit [`ffaae01`](https://github.com/apache/spark/commit/ffaae01af281a6dd724648d62bfd49c29c845cf6).


-- 
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


[GitHub] [spark] SparkQA removed a comment on pull request #33461: [SPARK-36243][SQL][PYTHON][DOCS] Fixing pyspark tableExists issue with temporary views

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884681107


   **[Test build #141474 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/141474/testReport)** for PR 33461 at commit [`ffaae01`](https://github.com/apache/spark/commit/ffaae01af281a6dd724648d62bfd49c29c845cf6).


-- 
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


[GitHub] [spark] dominikgehl commented on a change in pull request #33461: [SPARK-36243][SQL][PYTHON][DOCS] Fixing pyspark tableExists issue with temporary views

Posted by GitBox <gi...@apache.org>.
dominikgehl commented on a change in pull request #33461:
URL: https://github.com/apache/spark/pull/33461#discussion_r678031516



##########
File path: python/pyspark/sql/catalog.py
##########
@@ -180,15 +180,38 @@ 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:
+
+        >>> df = spark.sql("CREATE TEMPORARY VIEW view1 AS SELECT 1")
+        >>> spark.catalog.tableExists("view1")
+        True
+        >>> df = spark.sql("DROP VIEW view1")
+        >>> spark.catalog.tableExists("view1")
+        False
         """
-        if dbName is None:
-            dbName = self.currentDatabase()

Review comment:
       replacing None with the current database caused the scala side to always return 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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #33461: [SPARK-36243][SQL][PYTHON][DOCS] Fixing pyspark tableExists issue with temporary views

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884727257


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/45991/
   


-- 
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


[GitHub] [spark] SparkQA commented on pull request #33461: [SPARK-36243][PYTHON][DOCS] Fixing pyspark tableExists issue with temporary views

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884274754


   Kubernetes integration test starting
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/45932/
   


-- 
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


[GitHub] [spark] SparkQA commented on pull request #33461: [SPARK-36243][SQL][PYTHON][DOCS] Fixing pyspark tableExists issue with temporary views

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884716074


   Kubernetes integration test starting
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/45992/
   


-- 
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


[GitHub] [spark] AmplabJenkins commented on pull request #33461: [SPARK-36243][PYTHON][DOCS] Additional unit tests for pyspark tableExists

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884168405


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/45925/
   


-- 
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


[GitHub] [spark] SparkQA commented on pull request #33461: [SPARK-36243] Additional unit tests for pyspark tableExists

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884079107


   **[Test build #141401 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/141401/testReport)** for PR 33461 at commit [`18e0efc`](https://github.com/apache/spark/commit/18e0efcf61be3715646e06addedb2cc3fe87fa3f).
    * This patch **fails PySpark unit tests**.
    * This patch merges cleanly.
    * This patch adds no public classes.


-- 
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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #33461: [SPARK-36243] Additional unit tests for pyspark tableExists

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884109014


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/141408/
   


-- 
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


[GitHub] [spark] AmplabJenkins commented on pull request #33461: [SPARK-36243][SQL][PYTHON][DOCS] Fixing pyspark tableExists issue with temporary views

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884833889


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/45999/
   


-- 
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


[GitHub] [spark] SparkQA commented on pull request #33461: [SPARK-36243][PYTHON][DOCS] Fixing pyspark tableExists issue with temporary views

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884380539


   **[Test build #141414 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/141414/testReport)** for PR 33461 at commit [`9d3660a`](https://github.com/apache/spark/commit/9d3660a7b3254ac76daad11d5d4b535cf7d4a7d5).
    * This patch **fails Spark unit tests**.
    * This patch merges cleanly.
    * This patch adds no public classes.


-- 
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


[GitHub] [spark] AmplabJenkins commented on pull request #33461: [SPARK-36243][PYTHON][DOCS] Fixing pyspark tableExists issue with temporary views

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884308009


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/45932/
   


-- 
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


[GitHub] [spark] AmplabJenkins commented on pull request #33461: [SPARK-36243][SQL][PYTHON][DOCS] Fixing pyspark tableExists issue with temporary views

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884793159


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/46000/
   


-- 
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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #33461: [SPARK-36243][PYTHON][DOCS] Fixing pyspark tableExists issue with temporary views

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884308977


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/141423/
   


-- 
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


[GitHub] [spark] HyukjinKwon closed pull request #33461: [SPARK-36243][SQL][PYTHON][DOCS] Fixing pyspark tableExists issue with temporary views

Posted by GitBox <gi...@apache.org>.
HyukjinKwon closed pull request #33461:
URL: https://github.com/apache/spark/pull/33461


   


-- 
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


[GitHub] [spark] dominikgehl commented on a change in pull request #33461: [SPARK-36243][PYTHON][DOCS] Additional unit tests for pyspark tableExists

Posted by GitBox <gi...@apache.org>.
dominikgehl commented on a change in pull request #33461:
URL: https://github.com/apache/spark/pull/33461#discussion_r674004064



##########
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:
       Thanks for the comment. Changed




-- 
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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #33461: [SPARK-36243][PYTHON][DOCS] Fixing pyspark tableExists issue with temporary views

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884308009


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/45932/
   


-- 
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


[GitHub] [spark] HyukjinKwon commented on a change in pull request #33461: [SPARK-36243][SQL][PYTHON][DOCS] Fixing pyspark tableExists issue with temporary views

Posted by GitBox <gi...@apache.org>.
HyukjinKwon commented on a change in pull request #33461:
URL: https://github.com/apache/spark/pull/33461#discussion_r678046290



##########
File path: python/pyspark/sql/catalog.py
##########
@@ -180,15 +180,38 @@ 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:
+
+        >>> df = spark.sql("CREATE TEMPORARY VIEW view1 AS SELECT 1")
+        >>> spark.catalog.tableExists("view1")
+        True
+        >>> df = spark.sql("DROP VIEW view1")
+        >>> spark.catalog.tableExists("view1")
+        False
         """
-        if dbName is None:
-            dbName = self.currentDatabase()

Review comment:
       yeah, i think it was a mistake. This is matched with Scala side:
   
   https://github.com/apache/spark/blob/5d74ace648422e7a9bff7774ac266372934023b9/sql/core/src/main/scala/org/apache/spark/sql/internal/CatalogImpl.scala#L251-L254




-- 
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


[GitHub] [spark] SparkQA commented on pull request #33461: [SPARK-36243] Additional unit tests for pyspark tableExists

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884108784


   **[Test build #141408 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/141408/testReport)** for PR 33461 at commit [`762b891`](https://github.com/apache/spark/commit/762b891d43ee24c8aa0b76443db773b5b4938cdb).
    * This patch **fails PySpark unit tests**.
    * This patch merges cleanly.
    * This patch adds no public classes.


-- 
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


[GitHub] [spark] SparkQA removed a comment on pull request #33461: [SPARK-36243][PYTHON][DOCS] Fixing pyspark tableExists issue with temporary views

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884220270


   **[Test build #141415 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/141415/testReport)** for PR 33461 at commit [`474f695`](https://github.com/apache/spark/commit/474f695d7c9a29b87e370d12b4db4ad6de34b445).


-- 
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


[GitHub] [spark] AmplabJenkins commented on pull request #33461: [SPARK-36243][SQL][PYTHON][DOCS] Fixing pyspark tableExists issue with temporary views

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884696495


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/141474/
   


-- 
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


[GitHub] [spark] HyukjinKwon commented on a change in pull request #33461: [SPARK-36243][SQL][PYTHON][DOCS] Fixing pyspark tableExists issue with temporary views

Posted by GitBox <gi...@apache.org>.
HyukjinKwon commented on a change in pull request #33461:
URL: https://github.com/apache/spark/pull/33461#discussion_r674457920



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/execution/SQLViewTestSuite.scala
##########
@@ -381,6 +381,21 @@ class LocalTempViewTestSuite extends SQLViewTestSuite with SharedSparkSession {
   override protected def tableIdentifier(viewName: String): TableIdentifier = {
     TableIdentifier(viewName)
   }
+
+  test("SPARK-36243: tableExists should report correctly on temporary view") {
+    Seq(true, false).foreach { storeAnalyzed =>
+      withSQLConf(STORE_ANALYZED_PLAN_FOR_VIEW.key -> storeAnalyzed.toString) {
+        val tblIdent = tableIdentifier("v")
+        assert(!spark.sessionState.catalog.tableExists(tblIdent))
+        val viewName = createView("v", "SELECT 1")
+        withView(viewName) {
+          assert(spark.sessionState.catalog.isTempView(tableIdentifier("v")))

Review comment:
       The test here seems failing:
   
   ```
   sbt.ForkMain$ForkError: org.scalatest.exceptions.TestFailedException: LocalTempViewTestSuite.this.spark.sessionState.catalog.tableExists(LocalTempViewTestSuite.this.tableIdentifier("v")) was false
   	at org.scalatest.Assertions.newAssertionFailedException(Assertions.scala:472)
   	at org.scalatest.Assertions.newAssertionFailedException$(Assertions.scala:471)
   	at org.scalatest.Assertions$.newAssertionFailedException(Assertions.scala:1231)
   	at org.scalatest.Assertions$AssertionsHelper.macroAssert(Assertions.scala:1295)
   	at org.apache.spark.sql.execution.LocalTempViewTestSuite.$anonfun$new$87(SQLViewTestSuite.scala:392)
   	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
   	at org.apache.spark.util.Utils$.tryWithSafeFinally(Utils.scala:1468)
   	at org.apache.spark.sql.test.SQLTestUtilsBase.withView(SQLTestUtils.scala:316)
   	at org.apache.spark.sql.test.SQLTestUtilsBase.withView$(SQLTestUtils.scala:314)
   ```




-- 
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


[GitHub] [spark] AmplabJenkins commented on pull request #33461: [SPARK-36243][SQL][PYTHON][DOCS] Fixing pyspark tableExists issue with temporary views

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884758764






-- 
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


[GitHub] [spark] dominikgehl commented on a change in pull request #33461: [SPARK-36243][PYTHON][DOCS] Fixing pyspark tableExists issue with temporary views

Posted by GitBox <gi...@apache.org>.
dominikgehl commented on a change in pull request #33461:
URL: https://github.com/apache/spark/pull/33461#discussion_r674073600



##########
File path: python/pyspark/sql/tests/test_catalog.py
##########
@@ -210,17 +210,34 @@ def test_list_columns(self):
 
     def test_table_exists(self):
         # SPARK-36176: testing that table_exists returns correct boolean
+        from pyspark.sql.catalog import Table

Review comment:
       Moved all tests as you suggested.




-- 
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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #33461: [SPARK-36243][PYTHON][DOCS] Fixing pyspark tableExists issue with temporary views

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884302192


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/45931/
   


-- 
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


[GitHub] [spark] gatorsmile commented on a change in pull request #33461: [SPARK-36243][SQL][PYTHON][DOCS] Fixing pyspark tableExists issue with temporary views

Posted by GitBox <gi...@apache.org>.
gatorsmile commented on a change in pull request #33461:
URL: https://github.com/apache/spark/pull/33461#discussion_r677934742



##########
File path: python/pyspark/sql/catalog.py
##########
@@ -180,15 +180,38 @@ 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:
+
+        >>> df = spark.sql("CREATE TEMPORARY VIEW view1 AS SELECT 1")
+        >>> spark.catalog.tableExists("view1")
+        True
+        >>> df = spark.sql("DROP VIEW view1")
+        >>> spark.catalog.tableExists("view1")
+        False
         """
-        if dbName is None:
-            dbName = self.currentDatabase()

Review comment:
       Any reason?




-- 
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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #33461: [SPARK-36243][PYTHON][DOCS] Fixing pyspark tableExists issue with temporary views

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884380420






-- 
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


[GitHub] [spark] HyukjinKwon commented on pull request #33461: [SPARK-36243][SQL][PYTHON][DOCS] Fixing pyspark tableExists issue with temporary views

Posted by GitBox <gi...@apache.org>.
HyukjinKwon commented on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884765609


   Merged to master.


-- 
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


[GitHub] [spark] SparkQA commented on pull request #33461: [SPARK-36243][SQL][PYTHON][DOCS] Fixing pyspark tableExists issue with temporary views

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884707363


   Kubernetes integration test starting
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/45991/
   


-- 
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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #33461: [SPARK-36243][SQL][PYTHON][DOCS] Fixing pyspark tableExists issue with temporary views

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884793159


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/46000/
   


-- 
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


[GitHub] [spark] SparkQA commented on pull request #33461: [SPARK-36243][SQL][PYTHON][DOCS] Fixing pyspark tableExists issue with temporary views

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884742004


   Kubernetes integration test status success
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/45992/
   


-- 
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


[GitHub] [spark] SparkQA commented on pull request #33461: [SPARK-36243][SQL][PYTHON][DOCS] Fixing pyspark tableExists issue with temporary views

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884927194


   **[Test build #141473 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/141473/testReport)** for PR 33461 at commit [`0d03776`](https://github.com/apache/spark/commit/0d037763e71a0125e0eef2171f870ccb474e10d4).
    * This patch passes all tests.
    * This patch merges cleanly.
    * This patch adds no public classes.


-- 
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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #33461: [SPARK-36243][SQL][PYTHON][DOCS] Fixing pyspark tableExists issue with temporary views

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884758764






-- 
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


[GitHub] [spark] SparkQA removed a comment on pull request #33461: [SPARK-36243] Additional unit tests for pyspark tableExists

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884059592


   **[Test build #141401 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/141401/testReport)** for PR 33461 at commit [`18e0efc`](https://github.com/apache/spark/commit/18e0efcf61be3715646e06addedb2cc3fe87fa3f).


-- 
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


[GitHub] [spark] SparkQA removed a comment on pull request #33461: [SPARK-36243] Additional unit tests for pyspark tableExists

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884062645


   **[Test build #141405 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/141405/testReport)** for PR 33461 at commit [`848a280`](https://github.com/apache/spark/commit/848a280e9b326b2a3f72ca0a4b1822e9d7dd461d).


-- 
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


[GitHub] [spark] HyukjinKwon commented on a change in pull request #33461: [SPARK-36243][PYTHON][DOCS] Fixing pyspark tableExists issue with temporary views

Posted by GitBox <gi...@apache.org>.
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: 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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #33461: [SPARK-36243][PYTHON][DOCS] Additional unit tests for pyspark tableExists

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884168405


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/45925/
   


-- 
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


[GitHub] [spark] SparkQA commented on pull request #33461: [SPARK-36243] Additional unit tests for pyspark tableExists

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884075091


   **[Test build #141405 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/141405/testReport)** for PR 33461 at commit [`848a280`](https://github.com/apache/spark/commit/848a280e9b326b2a3f72ca0a4b1822e9d7dd461d).
    * This patch **fails PySpark unit tests**.
    * This patch merges cleanly.
    * This patch adds no public classes.


-- 
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


[GitHub] [spark] AmplabJenkins commented on pull request #33461: [SPARK-36243][PYTHON][DOCS] Fixing pyspark tableExists issue with temporary views

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884308977


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/141423/
   


-- 
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


[GitHub] [spark] SparkQA commented on pull request #33461: [SPARK-36243] Additional unit tests for pyspark tableExists

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884062645


   **[Test build #141405 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/141405/testReport)** for PR 33461 at commit [`848a280`](https://github.com/apache/spark/commit/848a280e9b326b2a3f72ca0a4b1822e9d7dd461d).


-- 
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


[GitHub] [spark] dominikgehl commented on a change in pull request #33461: [SPARK-36243][SQL][PYTHON][DOCS] Fixing pyspark tableExists issue with temporary views

Posted by GitBox <gi...@apache.org>.
dominikgehl commented on a change in pull request #33461:
URL: https://github.com/apache/spark/pull/33461#discussion_r678054075



##########
File path: python/pyspark/sql/catalog.py
##########
@@ -180,15 +180,38 @@ 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:
+
+        >>> df = spark.sql("CREATE TEMPORARY VIEW view1 AS SELECT 1")
+        >>> spark.catalog.tableExists("view1")
+        True
+        >>> df = spark.sql("DROP VIEW view1")
+        >>> spark.catalog.tableExists("view1")
+        False
         """
-        if dbName is None:
-            dbName = self.currentDatabase()

Review comment:
       The scala documentation specifies
    
   https://github.com/apache/spark/blob/master/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/SessionCatalog.scala#L955-L956




-- 
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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #33461: [SPARK-36243][PYTHON][DOCS] Fixing pyspark tableExists issue with temporary views

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #33461:
URL: https://github.com/apache/spark/pull/33461#issuecomment-884469740


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/141415/
   


-- 
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