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 2020/03/13 03:01:20 UTC

[GitHub] [spark] Eric5553 opened a new pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Eric5553 opened a new pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897
 
 
   ### What changes were proposed in this pull request?
   Previously, user can issue `SHOW TABLES` to get info of both tables and views.
   This PR implements `SHOW VIEWS` SQL command similar to HIVE to get views only.(https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL#LanguageManualDDL-ShowViews)
   
   
   ### Why are the changes needed?
   `SHOW VIEWS` command provides better granularity to only get information of views.
   
   
   ### Does this PR introduce any user-facing change?
   Add new `SHOW VIEWS` SQL command
   
   
   ### How was this patch tested?
   Add new test `show-views.sql` and pass existing 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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-607661991
 
 
   Test FAILed.
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/120707/
   Test FAILed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-598573176
 
 
   **[Test build #119746 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/119746/testReport)** for PR 27897 at commit [`7b7ef6e`](https://github.com/apache/spark/commit/7b7ef6e5b4e931a156a5c88eec35f107ad3def7b).

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-599926052
 
 
   Test PASSed.
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/24650/
   Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] maropu commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
maropu commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#discussion_r393453299
 
 

 ##########
 File path: docs/sql-ref-syntax-aux-show-views.md
 ##########
 @@ -0,0 +1,107 @@
+---
+layout: global
+title: SHOW VIEWS
+displayTitle: SHOW VIEWS
+license: |
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+ 
+     http://www.apache.org/licenses/LICENSE-2.0
+ 
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+---
+### Description
+
+The `SHOW VIEWS` statement returns all the views for an optionally specified database.
+Additionally, the output of this statement may be filtered by an optional matching
+pattern. If no database is specified then the views are returned from the 
+current database. Note that both global and local temporary views are also returned.
+
+### Syntax
+{% highlight sql %}
+SHOW VIEWS [ { FROM | IN } database_name ] [ LIKE 'regex_pattern' ]
+{% endhighlight %}
+
+### Parameters
+<dl>
+  <dt><code><em>{ FROM | IN } database_name</em></code></dt>
+  <dd>
+     Specifies the database name from which views are listed.
+  </dd>
+  <dt><code><em>LIKE regex_pattern</em></code></dt>
+  <dd>
+     Specifies the regular expression pattern that is used to filter out unwanted views. 
+     <ul> 
+          <li> Except for `*` and `|` character, the pattern works like a regex.</li>
+          <li> `*` alone matches 0 or more characters and `|` is used to separate multiple different regexes,
+           any of which can match. </li>
+          <li> The leading and trailing blanks are trimmed in the input pattern before processing.</li>
+     </ul>
+    
+  </dd>
+</dl>
+
+### Example
+{% highlight sql %}
+-- List all views in default database
 
 Review comment:
   Yea, thanks!

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-605434258
 
 
   Merged build finished. Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-608272990
 
 
   Test PASSed.
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/25455/
   Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-608268024
 
 
   Merged build finished. Test FAILed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-605462755
 
 
   **[Test build #120532 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/120532/testReport)** for PR 27897 at commit [`3e1576a`](https://github.com/apache/spark/commit/3e1576abac32719dfce55d3baf217a5b5c65a574).

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] Eric5553 commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
Eric5553 commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#discussion_r399800015
 
 

 ##########
 File path: sql/core/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveSessionCatalog.scala
 ##########
 @@ -530,6 +523,16 @@ class ResolveSessionCatalog(
         replace,
         viewType)
 
+    case ShowViewsStatement(SessionCatalogAndNamespace(_, ns), pattern) =>
 
 Review comment:
   Updated and added a negative test case in `DataSourceV2SQLSuite`

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] cloud-fan commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#discussion_r401337396
 
 

 ##########
 File path: sql/core/src/test/scala/org/apache/spark/sql/connector/DataSourceV2SQLSuite.scala
 ##########
 @@ -909,6 +909,23 @@ class DataSourceV2SQLSuite
     assert(exception.getMessage.contains("The database name is not valid: a.b"))
   }
 
+  test("ShowViews: using v1 catalog, db name with multipartIdentifier ('a.b') is not allowed.") {
+    val exception = intercept[AnalysisException] {
+      runShowTablesSql("SHOW VIEWS FROM a.b", Seq(), expectV2Catalog = false, isShowView = true)
 
 Review comment:
   can we not call `runShowTablesSql`? We only need to check error and it's easier to just write `sql("SHOW VIEWS FROM a.b")`

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] Eric5553 commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
Eric5553 commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#discussion_r399406192
 
 

 ##########
 File path: sql/core/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveSessionCatalog.scala
 ##########
 @@ -530,6 +523,16 @@ class ResolveSessionCatalog(
         replace,
         viewType)
 
+    case ShowViewsStatement(SessionCatalogAndNamespace(_, ns), pattern) =>
 
 Review comment:
   I see, thanks so much for your clarification, @cloud-fan ! `SessionCatalogAndNamespace` is a support function to make sure the resolved catalog is `SessionCatalog`, which supports several V1 commands. So I think maybe we should just throw `AnalysisException` in `SessionCatalogAndNamespace`? WDYT, updated in d14b4fa698873cf0eef4f1ca50b9a501c5cd868e.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-605434258
 
 
   Merged build finished. Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-602533038
 
 
   Merged build finished. Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-601021355
 
 
   Merged build finished. Test FAILed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-608272981
 
 
   Merged build finished. Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
SparkQA commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-602155386
 
 
   **[Test build #120145 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/120145/testReport)** for PR 27897 at commit [`6051772`](https://github.com/apache/spark/commit/60517726102633c86121a749a0d097c546b31817).
    * 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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
SparkQA commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-610477152
 
 
   **[Test build #120922 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/120922/testReport)** for PR 27897 at commit [`f6132c0`](https://github.com/apache/spark/commit/f6132c0e40e8cd20ed9620f27ad5ba0983891a3f).

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-606960582
 
 
   **[Test build #120657 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/120657/testReport)** for PR 27897 at commit [`90d7019`](https://github.com/apache/spark/commit/90d70196de70b7a93b01e188fda85682a65dc24e).

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-608392468
 
 
   Merged build finished. Test FAILed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
SparkQA commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-607600026
 
 
   **[Test build #120707 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/120707/testReport)** for PR 27897 at commit [`55a5997`](https://github.com/apache/spark/commit/55a5997bdfe34439a171d3603fc98975b7c18129).

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] dongjoon-hyun commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#discussion_r404415933
 
 

 ##########
 File path: sql/core/src/main/scala/org/apache/spark/sql/execution/HiveResult.scala
 ##########
 @@ -50,6 +50,10 @@ object HiveResult {
     // namespace and table name.
     case command : ShowTablesExec =>
       command.executeCollect().map(_.getString(1))
+    // SHOW VIEWS in Hive only outputs table names while our v1 command outputs
+    // namespace, table name, and isTemp.
 
 Review comment:
   `table name` -> `view name`?
   Maybe, `viewName` and `isTemporary` are better.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] Eric5553 commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
Eric5553 commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-610480430
 
 
   Hi, @dongjoon-hyun, thanks so much for your help! And sorry for my mistakes... I've addressed them 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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] Eric5553 commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
Eric5553 commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#discussion_r394099580
 
 

 ##########
 File path: docs/sql-ref-syntax-aux-show-views.md
 ##########
 @@ -0,0 +1,125 @@
+---
+layout: global
+title: SHOW VIEWS
+displayTitle: SHOW VIEWS
+license: |
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+ 
+     http://www.apache.org/licenses/LICENSE-2.0
+ 
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+---
+### Description
+
+The `SHOW VIEWS` statement returns all the views for an optionally specified database.
+Additionally, the output of this statement may be filtered by an optional matching
+pattern. If no database is specified then the views are returned from the 
+current database. Note that the command always lists global and temporary views 
+regardless of a given database.
+
+### Syntax
+{% highlight sql %}
+SHOW VIEWS [ { FROM | IN } database_name ] [ LIKE 'regex_pattern' ]
+{% endhighlight %}
+
+### Parameters
+<dl>
+  <dt><code><em>{ FROM | IN } database_name</em></code></dt>
+  <dd>
+     Specifies the database name from which views are listed.
+  </dd>
+  <dt><code><em>LIKE regex_pattern</em></code></dt>
+  <dd>
+     Specifies the regular expression pattern that is used to filter out unwanted views. 
+     <ul> 
+          <li> Except for `*` and `|` character, the pattern works like a regex.</li>
+          <li> `*` alone matches 0 or more characters and `|` is used to separate multiple different regexes,
+           any of which can match. </li>
+          <li> The leading and trailing blanks are trimmed in the input pattern before processing.</li>
+     </ul>
+    
+  </dd>
+</dl>
+
+### Example
+{% highlight sql %}
+-- Create views in different databases, also create global/local temp views.
+CREATE VIEW sam AS SELECT id, salary FROM employee WHERE name = 'sam';
+CREATE VIEW sam1 AS SELECT id, salary FROM employee WHERE name = 'sam1';
+CREATE VIEW suj AS SELECT id, salary FROM employee WHERE name = 'suj';
+USE userdb;
+CREATE VIEW user1 AS SELECT id, salary FROM employee WHERE name = 'user1';
+CREATE VIEW user2 AS SELECT id, salary FROM employee WHERE name = 'user2';
+USE default;
+CREATE GLOBAL TEMP VIEW temp1 AS SELECT 1 as col1;
+CREATE TEMP VIEW temp2 AS SELECT 1 as col1;
+
+-- List all views in default database
+SHOW VIEWS;
+  +-------------+------------+--------------+--+
+  | database    | viewName   | isTemporary  |
+  +-------------+------------+--------------+--+
+  | default     | sam        | false        |
+  | default     | sam1       | false        |
+  | default     | suj        | false        |
+  | global_temp | temp1      | true         |
+  |             | temp2      | true         |
+  +-------------+------------+--------------+--+
+
+-- List all views from userdb database 
+SHOW VIEWS FROM userdb;
+  +-------------+------------+--------------+--+
+  | database    | viewName   | isTemporary  |
+  +-------------+------------+--------------+--+
+  | userdb      | user1      | false        |
+  | userdb      | user2      | false        |
+  | global_temp | temp1      | true         |
+  |             | temp2      | true         |
+  +-------------+------------+--------------+--+
+
+-- List all views in userdb database
+SHOW VIEWS IN userdb;
+  +-------------+------------+--------------+--+
+  | database    | viewName   | isTemporary  |
+  +-------------+------------+--------------+--+
+  | userdb      | user1      | false        |
+  | userdb      | user2      | false        |
+  | global_temp | temp1      | true         |
+  |             | temp2      | true         |
+  +-------------+------------+--------------+--+
+
+-- List all views from default database matching the pattern `sam*`
+SHOW VIEWS FROM default LIKE 'sam*';
+  +-----------+------------+--------------+--+
+  | database  | viewName   | isTemporary  |
+  +-----------+------------+--------------+--+
+  | default   | sam        | false        |
+  | default   | sam1       | false        |
+  +-----------+------------+--------------+--+
+  
+-- List all views matching the pattern `sam*|suj`
+SHOW VIEWS LIKE 'sam*|suj';
 
 Review comment:
   Yea, updated in 475f21e248f9102e93263c75d7f2ef710fe4c9e1.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
SparkQA commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-607313813
 
 
   **[Test build #120681 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/120681/testReport)** for PR 27897 at commit [`2f8074a`](https://github.com/apache/spark/commit/2f8074a48c23f3c922958fa95c56cb5ffd64bc35).

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-601021658
 
 
   Test FAILed.
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/120024/
   Test FAILed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] wangyum commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
wangyum commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-602624940
 
 
   +1 to support `SHOW VIEWS` in Spark 3.0.
   ![image](https://user-images.githubusercontent.com/5399861/77325910-f2b6c980-6d53-11ea-8182-361a911bab3b.png)
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-605373943
 
 
   **[Test build #120520 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/120520/testReport)** for PR 27897 at commit [`522f63b`](https://github.com/apache/spark/commit/522f63b521b70fc0b3de689f45e468bf91092726).

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-600458500
 
 
   Test FAILed.
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/119968/
   Test FAILed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] maropu commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
maropu commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-600328076
 
 
   +1 on the splitting as @dongjoon-hyun suggested. btw, thanks for the review, Dongjoon! 

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] Eric5553 commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
Eric5553 commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#discussion_r394099946
 
 

 ##########
 File path: sql/core/src/test/resources/sql-tests/inputs/show-views.sql
 ##########
 @@ -0,0 +1,31 @@
+-- Test data.
+CREATE DATABASE showdb;
+USE showdb;
+CREATE TABLE tbl(a String, b Int, c String, d String) USING parquet;
+CREATE VIEW view_1 AS SELECT * FROM tbl;
+CREATE VIEW view_2 AS SELECT * FROM tbl WHERE c='a';
+CREATE TEMPORARY VIEW view_3(e int) USING parquet;
+CREATE GLOBAL TEMP VIEW view_4 AS SELECT 1 as col1;
+
+-- SHOW VIEWS
+SHOW VIEWS;
+SHOW VIEWS FROM showdb;
+SHOW VIEWS IN showdb;
+SHOW VIEWS IN global_temp;
+
+-- SHOW VIEWS WITH wildcard match
+SHOW VIEWS 'view_*';
+SHOW VIEWS LIKE 'view_1*|view_2*';
+SHOW VIEWS IN showdb 'view_*';
+SHOW VIEWS IN showdb LIKE 'view_*';
+-- Error when database not exists
+SHOW VIEWS IN wrongdb LIKE 'view_*';
+
+-- Clean Up
+DROP VIEW view_1;
+DROP VIEW view_2;
+DROP VIEW view_3;
+DROP VIEW global_temp.view_4;
+DROP TABLE tbl;
+USE default;
+DROP DATABASE showdb;
 
 Review comment:
   Yea, sure.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-598581383
 
 
   Merged build finished. Test FAILed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-601056289
 
 
   Test PASSed.
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/24759/
   Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] Eric5553 commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
Eric5553 commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#discussion_r393428635
 
 

 ##########
 File path: sql/core/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveSessionCatalog.scala
 ##########
 @@ -530,6 +523,16 @@ class ResolveSessionCatalog(
         replace,
         viewType)
 
+    case ShowViewsStatement(SessionCatalogAndNamespace(_, ns), pattern) =>
+      val namespace = if (ns.isEmpty) {
+        None
+      } else if (ns.length == 1) {
+        Some(ns.head)
+      } else {
+        throw new AnalysisException(s"The database name is not valid: ${ns.quoted}")
 
 Review comment:
   When creating database/namespace like `CREATE NAMESPACE ns1.ns2`, it throws invalid database name error. Does it related V2 Session Catalog or some other reasons? Sorry for my lack of related knowledge. 

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-599925425
 
 
   **[Test build #119925 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/119925/testReport)** for PR 27897 at commit [`1d56c0e`](https://github.com/apache/spark/commit/1d56c0e4fbe9a26232d6856a253371d16f24d4da).

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-600989390
 
 
   **[Test build #120024 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/120024/testReport)** for PR 27897 at commit [`b15a32b`](https://github.com/apache/spark/commit/b15a32bb0db5d2ddcc90b791c3aee2246342cdd8).

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-608267722
 
 
   Test FAILed.
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/120750/
   Test FAILed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-607600417
 
 
   Merged build finished. Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
SparkQA commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-602558779
 
 
   **[Test build #120201 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/120201/testReport)** for PR 27897 at commit [`01004a9`](https://github.com/apache/spark/commit/01004a9701ac56f7ed0a7db21972a444a1085039).

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] dongjoon-hyun commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#discussion_r393943765
 
 

 ##########
 File path: sql/core/src/test/resources/sql-tests/inputs/show-views.sql
 ##########
 @@ -0,0 +1,31 @@
+-- Test data.
+CREATE DATABASE showdb;
+USE showdb;
+CREATE TABLE tbl(a String, b Int, c String, d String) USING parquet;
+CREATE VIEW view_1 AS SELECT * FROM tbl;
+CREATE VIEW view_2 AS SELECT * FROM tbl WHERE c='a';
+CREATE TEMPORARY VIEW view_3(e int) USING parquet;
+CREATE GLOBAL TEMP VIEW view_4 AS SELECT 1 as col1;
+
+-- SHOW VIEWS
+SHOW VIEWS;
+SHOW VIEWS FROM showdb;
+SHOW VIEWS IN showdb;
+SHOW VIEWS IN global_temp;
+
+-- SHOW VIEWS WITH wildcard match
+SHOW VIEWS 'view_*';
+SHOW VIEWS LIKE 'view_1*|view_2*';
+SHOW VIEWS IN showdb 'view_*';
+SHOW VIEWS IN showdb LIKE 'view_*';
+-- Error when database not exists
+SHOW VIEWS IN wrongdb LIKE 'view_*';
+
+-- Clean Up
+DROP VIEW view_1;
+DROP VIEW view_2;
+DROP VIEW view_3;
+DROP VIEW global_temp.view_4;
+DROP TABLE tbl;
+USE default;
+DROP DATABASE showdb;
 
 Review comment:
   `DROP DATABASE showdb CASCADE;`? Then, you can remove line 25 and 26.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-601054766
 
 
   **[Test build #120040 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/120040/testReport)** for PR 27897 at commit [`9ce0564`](https://github.com/apache/spark/commit/9ce0564a24285442fe6088d2044b802b4b7e39e1).

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-598526392
 
 
   Merged build finished. Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-607890248
 
 
   Merged build finished. Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
SparkQA commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-607889396
 
 
   **[Test build #120729 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/120729/testReport)** for PR 27897 at commit [`6a4348e`](https://github.com/apache/spark/commit/6a4348ed9e289c6ca3cc557f9a575e1829f53fc0).

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] Eric5553 commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
Eric5553 commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#discussion_r400975336
 
 

 ##########
 File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/statements.scala
 ##########
 @@ -343,6 +343,15 @@ case class ShowTableStatement(
     partitionSpec: Option[TablePartitionSpec])
   extends ParsedStatement
 
+/**
+ * A SHOW VIEWS statement, as parsed from SQL.
+ */
+case class ShowViewsStatement(
 
 Review comment:
   Thanks so much for the background introduction! I think I misunderstood the scope between V2 command and V2 SessionCatalog, that's why I wrongly followed V1 command style before. 
   Sure, I'll update it to V2 command.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-599911027
 
 
   Test FAILed.
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/119904/
   Test FAILed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] Eric5553 commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
Eric5553 commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#discussion_r401291743
 
 

 ##########
 File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/statements.scala
 ##########
 @@ -343,6 +343,15 @@ case class ShowTableStatement(
     partitionSpec: Option[TablePartitionSpec])
   extends ParsedStatement
 
+/**
+ * A SHOW VIEWS statement, as parsed from SQL.
+ */
+case class ShowViewsStatement(
 
 Review comment:
   Thanks for the suggestions, updated in 90d70196de70b7a93b01e188fda85682a65dc24e using v2 style `ShowViews`.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-606960873
 
 
   Test PASSed.
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/25356/
   Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-605106558
 
 
   Test PASSed.
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/25210/
   Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] cloud-fan commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#discussion_r397676149
 
 

 ##########
 File path: sql/core/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveSessionCatalog.scala
 ##########
 @@ -530,6 +523,16 @@ class ResolveSessionCatalog(
         replace,
         viewType)
 
+    case ShowViewsStatement(SessionCatalogAndNamespace(_, ns), pattern) =>
 
 Review comment:
   what's the error message if SHOW VIEWS refers to a custom catalog?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-601186226
 
 
   Merged build finished. Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] dongjoon-hyun commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#discussion_r393954458
 
 

 ##########
 File path: sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveCommandSuite.scala
 ##########
 @@ -117,6 +117,51 @@ class HiveCommandSuite extends QueryTest with SQLTestUtils with TestHiveSingleto
     }
   }
 
+  test("show views") {
+    withView("default1a", "default2b", "temp1", "global_temp.temp2") {
+      sql("CREATE VIEW show1a AS SELECT 1 AS id")
+      sql("CREATE VIEW show2b AS SELECT 1 AS id")
+      sql("CREATE TEMP VIEW temp1 AS SELECT 1 AS id")
+      sql("CREATE GLOBAL TEMP VIEW temp2 AS SELECT 1 AS id")
 
 Review comment:
   Switch line 125 and 124 and the names `temp1` and `temp2`, 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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] Eric5553 commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
Eric5553 commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-600472824
 
 
   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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-605374088
 
 
   Test PASSed.
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/25226/
   Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-608392468
 
 
   Merged build finished. Test FAILed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] cloud-fan commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#discussion_r400919260
 
 

 ##########
 File path: docs/sql-ref-syntax-aux-show-views.md
 ##########
 @@ -0,0 +1,120 @@
+---
+layout: global
+title: SHOW VIEWS
+displayTitle: SHOW VIEWS
+license: |
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+ 
+     http://www.apache.org/licenses/LICENSE-2.0
+ 
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+---
+### Description
+
+The `SHOW VIEWS` statement returns all the views for an optionally specified database.
+Additionally, the output of this statement may be filtered by an optional matching
+pattern. If no database is specified then the views are returned from the 
+current database. Note that the command also lists local temporary views 
+regardless of a given database.
+
+### Syntax
+{% highlight sql %}
+SHOW VIEWS [ { FROM | IN } database_name ] [ LIKE 'regex_pattern' ]
+{% endhighlight %}
+
+### Parameters
+<dl>
+  <dt><code><em>{ FROM | IN } database_name</em></code></dt>
+  <dd>
+     Specifies the database name from which views are listed.
+  </dd>
+  <dt><code><em>LIKE regex_pattern</em></code></dt>
+  <dd>
+     Specifies the regular expression pattern that is used to filter out unwanted views. 
+     <ul> 
+          <li> Except for `*` and `|` character, the pattern works like a regex.</li>
+          <li> `*` alone matches 0 or more characters and `|` is used to separate multiple different regexes,
+           any of which can match. </li>
+          <li> The leading and trailing blanks are trimmed in the input pattern before processing.</li>
+     </ul>
+  </dd>
+</dl>
+
+### Example
+{% highlight sql %}
+-- Create views in different databases, also create global/local temp views.
+CREATE VIEW sam AS SELECT id, salary FROM employee WHERE name = 'sam';
+CREATE VIEW sam1 AS SELECT id, salary FROM employee WHERE name = 'sam1';
+CREATE VIEW suj AS SELECT id, salary FROM employee WHERE name = 'suj';
+USE userdb;
+CREATE VIEW user1 AS SELECT id, salary FROM employee WHERE name = 'user1';
+CREATE VIEW user2 AS SELECT id, salary FROM employee WHERE name = 'user2';
+USE default;
+CREATE GLOBAL TEMP VIEW temp1 AS SELECT 1 as col1;
+CREATE TEMP VIEW temp2 AS SELECT 1 as col1;
+
+-- List all views in default database
+SHOW VIEWS;
+  +-------------+------------+--------------+--+
+  | namespace   | viewName   | isTemporary  |
+  +-------------+------------+--------------+--+
+  | default     | sam        | false        |
+  | default     | sam1       | false        |
+  | default     | suj        | false        |
+  |             | temp2      | true         |
+  +-------------+------------+--------------+--+
+
+-- List all views from userdb database 
+SHOW VIEWS FROM userdb;
+  +-------------+------------+--------------+--+
+  | namespace   | viewName   | isTemporary  |
+  +-------------+------------+--------------+--+
+  | userdb      | user1      | false        |
+  | userdb      | user2      | false        |
+  |             | temp2      | true         |
+  +-------------+------------+--------------+--+
+  
+-- List all views in global temp view database 
+SHOW VIEWS IN global_temp;
+  +-------------+------------+--------------+--+
+  | namespace   | viewName   | isTemporary  |
+  +-------------+------------+--------------+--+
+  | global_temp | temp1      | true         |
+  |             | temp2      | true         |
+  +-------------+------------+--------------+--+
+
+-- List all views from default database matching the pattern `sam*`
+SHOW VIEWS FROM default LIKE 'sam*';
+  +-----------+------------+--------------+--+
+  | namespace | viewName   | isTemporary  |
+  +-----------+------------+--------------+--+
+  | default   | sam        | false        |
+  | default   | sam1       | false        |
+  +-----------+------------+--------------+--+
+
+-- List all views matching the pattern `sam|suj|temp*`
 
 Review comment:
   `List all views from the current database`

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-602129496
 
 
   Test PASSed.
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/24852/
   Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] Eric5553 commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
Eric5553 commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-600419138
 
 
   @dongjoon-hyun Thanks so much for the review. I've addressed them in 475f21e248f9102e93263c75d7f2ef710fe4c9e1 and will open another PR focusing on `getTablesByType` and `HiveShim`. I'll rebase this PR once the `getTablesByType` is ready.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] cloud-fan commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#discussion_r399141126
 
 

 ##########
 File path: docs/sql-ref-syntax-aux-show-views.md
 ##########
 @@ -0,0 +1,125 @@
+---
+layout: global
+title: SHOW VIEWS
+displayTitle: SHOW VIEWS
+license: |
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+ 
+     http://www.apache.org/licenses/LICENSE-2.0
+ 
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+---
+### Description
+
+The `SHOW VIEWS` statement returns all the views for an optionally specified database.
+Additionally, the output of this statement may be filtered by an optional matching
+pattern. If no database is specified then the views are returned from the 
+current database. Note that the command always lists global and temporary views 
+regardless of a given database.
+
+### Syntax
+{% highlight sql %}
+SHOW VIEWS [ { FROM | IN } database_name ] [ LIKE 'regex_pattern' ]
+{% endhighlight %}
+
+### Parameters
+<dl>
+  <dt><code><em>{ FROM | IN } database_name</em></code></dt>
+  <dd>
+     Specifies the database name from which views are listed.
+  </dd>
+  <dt><code><em>LIKE regex_pattern</em></code></dt>
+  <dd>
+     Specifies the regular expression pattern that is used to filter out unwanted views. 
+     <ul> 
+          <li> Except for `*` and `|` character, the pattern works like a regex.</li>
+          <li> `*` alone matches 0 or more characters and `|` is used to separate multiple different regexes,
+           any of which can match. </li>
+          <li> The leading and trailing blanks are trimmed in the input pattern before processing.</li>
+     </ul>
+  </dd>
+</dl>
+
+### Example
+{% highlight sql %}
+-- Create views in different databases, also create global/local temp views.
+CREATE VIEW sam AS SELECT id, salary FROM employee WHERE name = 'sam';
+CREATE VIEW sam1 AS SELECT id, salary FROM employee WHERE name = 'sam1';
+CREATE VIEW suj AS SELECT id, salary FROM employee WHERE name = 'suj';
+USE userdb;
+CREATE VIEW user1 AS SELECT id, salary FROM employee WHERE name = 'user1';
+CREATE VIEW user2 AS SELECT id, salary FROM employee WHERE name = 'user2';
+USE default;
+CREATE GLOBAL TEMP VIEW temp1 AS SELECT 1 as col1;
+CREATE TEMP VIEW temp2 AS SELECT 1 as col1;
+
+-- List all views in default database
+SHOW VIEWS;
+  +-------------+------------+--------------+--+
+  | database    | viewName   | isTemporary  |
+  +-------------+------------+--------------+--+
+  | default     | sam        | false        |
+  | default     | sam1       | false        |
+  | default     | suj        | false        |
+  | global_temp | temp1      | true         |
 
 Review comment:
   So we always list global temp views even if the database is not `global_temp`?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-608052032
 
 
   Test PASSed.
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/120729/
   Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-607037361
 
 
   Merged build finished. Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] Eric5553 commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
Eric5553 commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#discussion_r401701575
 
 

 ##########
 File path: sql/core/src/test/scala/org/apache/spark/sql/connector/DataSourceV2SQLSuite.scala
 ##########
 @@ -909,6 +909,23 @@ class DataSourceV2SQLSuite
     assert(exception.getMessage.contains("The database name is not valid: a.b"))
   }
 
+  test("ShowViews: using v1 catalog, db name with multipartIdentifier ('a.b') is not allowed.") {
+    val exception = intercept[AnalysisException] {
+      runShowTablesSql("SHOW VIEWS FROM a.b", Seq(), expectV2Catalog = false, isShowView = true)
+    }
+
+    assert(exception.getMessage.contains("The database name is not valid: a.b"))
+  }
+
+  test("ShowViews: using v2 catalog, command not supported.") {
+    val exception = intercept[AnalysisException] {
+      runShowTablesSql("SHOW VIEWS FROM testcat", Seq(), expectV2Catalog = true, isShowView = true)
 
 Review comment:
   2f8074a48c23f3c922958fa95c56cb5ffd64bc35

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] dongjoon-hyun commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#discussion_r401887315
 
 

 ##########
 File path: sql/core/src/main/scala/org/apache/spark/sql/execution/command/views.scala
 ##########
 @@ -295,6 +295,41 @@ case class AlterViewAsCommand(
   }
 }
 
+/**
+ * A command for users to get views in the given database.
+ * If a databaseName is not given, the current database will be used.
+ * The syntax of using this command in SQL is:
+ * {{{
+ *   SHOW VIEWS [(IN|FROM) database_name] [[LIKE] 'identifier_with_wildcards'];
+ * }}}
+ */
+case class ShowViewsCommand(
+    databaseName: Option[String],
+    tableIdentifierPattern: Option[String]) extends RunnableCommand {
+
+  // The result of SHOW VIEWS has three basic columns: database, viewName and isTemporary.
+  override val output: Seq[Attribute] = Seq(
+    AttributeReference("namespace", StringType, nullable = false)(),
 
 Review comment:
   This is inconsistent with line 310. At line 310, it's `database`. We should fix here or line 310, @Eric5553 .
   
   BTW, did we decide to use `namespace` here instead of `database` always, @cloud-fan and @maropu ?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-607314586
 
 
   Test PASSed.
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/25380/
   Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] Eric5553 commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
Eric5553 commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#discussion_r401698771
 
 

 ##########
 File path: sql/core/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveSessionCatalog.scala
 ##########
 @@ -545,6 +538,23 @@ class ResolveSessionCatalog(
         replace,
         viewType)
 
+    case ShowViews(resolved: ResolvedNamespace, pattern) =>
+      resolved match {
+        case SessionCatalogAndNamespace(_, ns) =>
+          // Fallback to v1 ShowViewsCommand since there is no view API in v2 catalog
+          val namespace = if (ns.isEmpty) {
 
 Review comment:
   Yea, that's right. Updated in 2f8074a48c23f3c922958fa95c56cb5ffd64bc35 to get along with `ShowTables` code style, thanks!

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-600046774
 
 
   Merged build finished. Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] dongjoon-hyun commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-600344667
 
 
   Thank you always for pinging me, @maropu . It helps me a lot when I missed many things in the community.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] Eric5553 commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
Eric5553 commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#discussion_r392671951
 
 

 ##########
 File path: sql/core/src/test/resources/sql-tests/results/show-views.sql.out
 ##########
 @@ -0,0 +1,211 @@
+-- Automatically generated by SQLQueryTestSuite
+-- Number of queries: 21
+
+
+-- !query
+CREATE DATABASE showdb
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+USE showdb
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+CREATE TABLE tbl(a String, b Int, c String, d String) USING parquet
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+CREATE VIEW view_1 AS SELECT * FROM tbl
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+CREATE VIEW view_2 AS SELECT * FROM tbl WHERE c='a'
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+CREATE TEMPORARY VIEW view_3(e int) USING parquet
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+CREATE GLOBAL TEMP VIEW view_4 AS SELECT 1 as col1
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+SHOW VIEWS
+-- !query schema
+struct<database:string,viewName:string,isTemporary:boolean>
 
 Review comment:
   I just found `HiveResult.hiveResultString` is used to update query result in Hive compatible form for `ShowTablesCommand`. Also add transform rule for `ShowViewsCommand` and updated PR description. Thanks.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
SparkQA commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-601021143
 
 
   **[Test build #120024 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/120024/testReport)** for PR 27897 at commit [`b15a32b`](https://github.com/apache/spark/commit/b15a32bb0db5d2ddcc90b791c3aee2246342cdd8).
    * This patch **fails due to an unknown error code, -9**.
    * 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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-601021342
 
 
   Merged build finished. Test FAILed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] cloud-fan commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#discussion_r403856836
 
 

 ##########
 File path: sql/core/src/test/scala/org/apache/spark/sql/connector/DataSourceV2SQLSuite.scala
 ##########
 @@ -954,15 +971,17 @@ class DataSourceV2SQLSuite
   private def runShowTablesSql(
       sqlText: String,
       expected: Seq[Row],
-      expectV2Catalog: Boolean = true): Unit = {
+      expectV2Catalog: Boolean = true,
+      isShowView: Boolean = false): Unit = {
 
 Review comment:
   unnecessary change

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-599888705
 
 
   Merged build finished. Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-608221321
 
 
   Test PASSed.
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/25449/
   Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] maropu edited a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
maropu edited a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-599019325
 
 
   (Just to check) Any other system (except for hive) supporting this command? Also, could you add a new entry for this command in the SQL doc? See: https://github.com/parano/spark-1/blob/master/docs/sql-ref-syntax-aux-show-tables.md

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
SparkQA commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-598581347
 
 
   **[Test build #119746 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/119746/testReport)** for PR 27897 at commit [`7b7ef6e`](https://github.com/apache/spark/commit/7b7ef6e5b4e931a156a5c88eec35f107ad3def7b).
    * This patch **fails due to an unknown error code, -9**.
    * 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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] maropu commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
maropu commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#discussion_r392732034
 
 

 ##########
 File path: sql/core/src/main/scala/org/apache/spark/sql/execution/command/views.scala
 ##########
 @@ -280,6 +280,44 @@ case class AlterViewAsCommand(
   }
 }
 
+/**
+ * A command for users to get views in the given database.
+ * If a databaseName is not given, the current database will be used.
+ * The syntax of using this command in SQL is:
+ * {{{
+ *   SHOW VIEWS [(IN|FROM) database_name] [[LIKE] 'identifier_with_wildcards'];
+ * }}}
+ */
+case class ShowViewsCommand(
+    databaseName: Option[String],
+    tableIdentifierPattern: Option[String]) extends RunnableCommand {
+
+  // The result of SHOW TABLES/SHOW TABLE has three basic columns: database, tableName and
+  // isTemporary. If `isExtended` is true, append column `information` to the output columns.
 
 Review comment:
   It seems you wrongly copied&pasted this comment from `ShowTablesCommand`.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] dongjoon-hyun commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-600286800
 
 
   BTW, this should be `3.1.0`.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-605457601
 
 
   Merged build finished. Test FAILed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
SparkQA commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-607460533
 
 
   **[Test build #120681 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/120681/testReport)** for PR 27897 at commit [`2f8074a`](https://github.com/apache/spark/commit/2f8074a48c23f3c922958fa95c56cb5ffd64bc35).
    * 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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] maropu commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
maropu commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#discussion_r392563107
 
 

 ##########
 File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/InMemoryCatalog.scala
 ##########
 @@ -346,6 +346,13 @@ class InMemoryCatalog(
     StringUtils.filterPattern(listTables(db), pattern)
   }
 
+  override def listViews(db: String, pattern: String): Seq[String] = synchronized {
+    requireDbExists(db)
+    val views = catalog(db).tables.filter(v => v._2.table.tableType == CatalogTableType.VIEW)
 
 Review comment:
   nit: `.filter(_._2.table.tableType == CatalogTableType.VIEW)`

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-609998207
 
 
   Test PASSed.
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/120878/
   Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-598526392
 
 
   Merged build finished. Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
SparkQA commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-599204900
 
 
   **[Test build #119817 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/119817/testReport)** for PR 27897 at commit [`c5570d2`](https://github.com/apache/spark/commit/c5570d249426a821896ab85e37bf2e0c1d9a39ee).

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-598723364
 
 
   Merged build finished. Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] Eric5553 commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
Eric5553 commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#discussion_r401291834
 
 

 ##########
 File path: docs/sql-ref-syntax-aux-show-views.md
 ##########
 @@ -0,0 +1,120 @@
+---
+layout: global
+title: SHOW VIEWS
+displayTitle: SHOW VIEWS
+license: |
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+ 
+     http://www.apache.org/licenses/LICENSE-2.0
+ 
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+---
+### Description
+
+The `SHOW VIEWS` statement returns all the views for an optionally specified database.
+Additionally, the output of this statement may be filtered by an optional matching
+pattern. If no database is specified then the views are returned from the 
+current database. Note that the command also lists local temporary views 
+regardless of a given database.
+
+### Syntax
+{% highlight sql %}
+SHOW VIEWS [ { FROM | IN } database_name ] [ LIKE 'regex_pattern' ]
+{% endhighlight %}
+
+### Parameters
+<dl>
+  <dt><code><em>{ FROM | IN } database_name</em></code></dt>
+  <dd>
+     Specifies the database name from which views are listed.
+  </dd>
+  <dt><code><em>LIKE regex_pattern</em></code></dt>
+  <dd>
+     Specifies the regular expression pattern that is used to filter out unwanted views. 
+     <ul> 
+          <li> Except for `*` and `|` character, the pattern works like a regex.</li>
+          <li> `*` alone matches 0 or more characters and `|` is used to separate multiple different regexes,
+           any of which can match. </li>
+          <li> The leading and trailing blanks are trimmed in the input pattern before processing.</li>
+     </ul>
+  </dd>
+</dl>
+
+### Example
+{% highlight sql %}
+-- Create views in different databases, also create global/local temp views.
+CREATE VIEW sam AS SELECT id, salary FROM employee WHERE name = 'sam';
+CREATE VIEW sam1 AS SELECT id, salary FROM employee WHERE name = 'sam1';
+CREATE VIEW suj AS SELECT id, salary FROM employee WHERE name = 'suj';
+USE userdb;
+CREATE VIEW user1 AS SELECT id, salary FROM employee WHERE name = 'user1';
+CREATE VIEW user2 AS SELECT id, salary FROM employee WHERE name = 'user2';
+USE default;
+CREATE GLOBAL TEMP VIEW temp1 AS SELECT 1 as col1;
+CREATE TEMP VIEW temp2 AS SELECT 1 as col1;
+
+-- List all views in default database
+SHOW VIEWS;
+  +-------------+------------+--------------+--+
+  | namespace   | viewName   | isTemporary  |
+  +-------------+------------+--------------+--+
+  | default     | sam        | false        |
+  | default     | sam1       | false        |
+  | default     | suj        | false        |
+  |             | temp2      | true         |
+  +-------------+------------+--------------+--+
+
+-- List all views from userdb database 
+SHOW VIEWS FROM userdb;
+  +-------------+------------+--------------+--+
+  | namespace   | viewName   | isTemporary  |
+  +-------------+------------+--------------+--+
+  | userdb      | user1      | false        |
+  | userdb      | user2      | false        |
+  |             | temp2      | true         |
+  +-------------+------------+--------------+--+
+  
+-- List all views in global temp view database 
+SHOW VIEWS IN global_temp;
+  +-------------+------------+--------------+--+
+  | namespace   | viewName   | isTemporary  |
+  +-------------+------------+--------------+--+
+  | global_temp | temp1      | true         |
+  |             | temp2      | true         |
+  +-------------+------------+--------------+--+
+
+-- List all views from default database matching the pattern `sam*`
+SHOW VIEWS FROM default LIKE 'sam*';
+  +-----------+------------+--------------+--+
+  | namespace | viewName   | isTemporary  |
+  +-----------+------------+--------------+--+
+  | default   | sam        | false        |
+  | default   | sam1       | false        |
+  +-----------+------------+--------------+--+
+
+-- List all views matching the pattern `sam|suj|temp*`
 
 Review comment:
   Updated in 90d70196de70b7a93b01e188fda85682a65dc24e, thanks.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] dongjoon-hyun commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#discussion_r401889323
 
 

 ##########
 File path: sql/core/src/main/scala/org/apache/spark/sql/execution/command/views.scala
 ##########
 @@ -295,6 +295,41 @@ case class AlterViewAsCommand(
   }
 }
 
+/**
+ * A command for users to get views in the given database.
+ * If a databaseName is not given, the current database will be used.
+ * The syntax of using this command in SQL is:
+ * {{{
+ *   SHOW VIEWS [(IN|FROM) database_name] [[LIKE] 'identifier_with_wildcards'];
+ * }}}
+ */
+case class ShowViewsCommand(
+    databaseName: Option[String],
+    tableIdentifierPattern: Option[String]) extends RunnableCommand {
+
+  // The result of SHOW VIEWS has three basic columns: database, viewName and isTemporary.
+  override val output: Seq[Attribute] = Seq(
+    AttributeReference("namespace", StringType, nullable = false)(),
 
 Review comment:
   Technically, `ShowTablesCommand` still uses `database` while `ShowTables` uses `namespace`. And, this is `ShowViewsCommand` as a V1 command.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-610477152
 
 
   **[Test build #120922 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/120922/testReport)** for PR 27897 at commit [`f6132c0`](https://github.com/apache/spark/commit/f6132c0e40e8cd20ed9620f27ad5ba0983891a3f).

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
SparkQA commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-598573176
 
 
   **[Test build #119746 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/119746/testReport)** for PR 27897 at commit [`7b7ef6e`](https://github.com/apache/spark/commit/7b7ef6e5b4e931a156a5c88eec35f107ad3def7b).

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
SparkQA commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-599925425
 
 
   **[Test build #119925 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/119925/testReport)** for PR 27897 at commit [`1d56c0e`](https://github.com/apache/spark/commit/1d56c0e4fbe9a26232d6856a253371d16f24d4da).

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] dongjoon-hyun commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#discussion_r393918282
 
 

 ##########
 File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/SessionCatalog.scala
 ##########
 @@ -880,6 +880,26 @@ class SessionCatalog(
     }
   }
 
+  /**
+   * List all matching views in the specified database, including global/local temporary views.
+   */
+  def listViews(db: String, pattern: String): Seq[TableIdentifier] = {
+    val dbName = formatDatabaseName(db)
+    val dbViews = if (dbName != globalTempViewManager.database) {
+      requireDbExists(dbName)
+      externalCatalog.listViews(dbName, pattern).map { name =>
+        TableIdentifier(name, Some(dbName))
+      }
+    } else {
+      Nil
+    }
+    // Always get global/local temp views
 
 Review comment:
   Since this is also based on pattern, we don't get result 'Always'.
   `Always get` -> `Always try to get` or we can remove this comment.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] cloud-fan commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#discussion_r400917849
 
 

 ##########
 File path: docs/sql-ref-syntax-aux-show-views.md
 ##########
 @@ -0,0 +1,120 @@
+---
+layout: global
+title: SHOW VIEWS
+displayTitle: SHOW VIEWS
+license: |
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+ 
+     http://www.apache.org/licenses/LICENSE-2.0
+ 
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+---
+### Description
+
+The `SHOW VIEWS` statement returns all the views for an optionally specified database.
+Additionally, the output of this statement may be filtered by an optional matching
+pattern. If no database is specified then the views are returned from the 
+current database. Note that the command also lists local temporary views 
+regardless of a given database.
 
 Review comment:
   can we update this doc?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-605457603
 
 
   Test FAILed.
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/120527/
   Test FAILed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
SparkQA commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-608563932
 
 
   **[Test build #120773 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/120773/testReport)** for PR 27897 at commit [`6d68ec4`](https://github.com/apache/spark/commit/6d68ec46f410ad697353cf1c6e9bf833171a5222).
    * 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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-605462920
 
 
   Test PASSed.
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/25239/
   Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
SparkQA commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-601021140
 
 
   **[Test build #120025 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/120025/testReport)** for PR 27897 at commit [`9ce0564`](https://github.com/apache/spark/commit/9ce0564a24285442fe6088d2044b802b4b7e39e1).
    * This patch **fails due to an unknown error code, -9**.
    * 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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-601186239
 
 
   Test PASSed.
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/120040/
   Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
SparkQA commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-608267510
 
 
   **[Test build #120750 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/120750/testReport)** for PR 27897 at commit [`7bd9cc6`](https://github.com/apache/spark/commit/7bd9cc662528a7fcfdb1f07b6565a0e6cac8512a).
    * This patch **fails due to an unknown error code, -9**.
    * 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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-608392475
 
 
   Test FAILed.
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/120756/
   Test FAILed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] cloud-fan commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#discussion_r392824410
 
 

 ##########
 File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/statements.scala
 ##########
 @@ -343,6 +343,15 @@ case class ShowTableStatement(
     partitionSpec: Option[TablePartitionSpec])
   extends ParsedStatement
 
+/**
+ * A SHOW VIEWS statement, as parsed from SQL.
+ */
+case class ShowViewsStatement(
 
 Review comment:
   can we follow how we implement `SHOW TABLES`?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
SparkQA commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-605401148
 
 
   **[Test build #120520 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/120520/testReport)** for PR 27897 at commit [`522f63b`](https://github.com/apache/spark/commit/522f63b521b70fc0b3de689f45e468bf91092726).
    * 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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
SparkQA commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-601021144
 
 
   **[Test build #120023 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/120023/testReport)** for PR 27897 at commit [`6e6d848`](https://github.com/apache/spark/commit/6e6d848a35e3227789f0cffbb7bcbe9fcdf202cb).
    * This patch **fails due to an unknown error code, -9**.
    * 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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-601010148
 
 
   Merged build finished. Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-607661983
 
 
   Merged build finished. Test FAILed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-605374085
 
 
   Merged build finished. Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] Eric5553 commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
Eric5553 commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#discussion_r402030477
 
 

 ##########
 File path: sql/core/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveSessionCatalog.scala
 ##########
 @@ -230,22 +230,19 @@ class ResolveSessionCatalog(
 
     case d @ DescribeNamespace(SessionCatalogAndNamespace(_, ns), _) =>
       if (ns.length != 1) {
-        throw new AnalysisException(
-          s"The database name is not valid: ${ns.quoted}")
+        throw new AnalysisException(s"The database name is not valid: ${ns.quoted}")
 
 Review comment:
   Sure, I've reverted these untouched lines. Thanks as always @dongjoon-hyun @maropu !

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-600985687
 
 
   Merged build finished. Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-605457603
 
 
   Test FAILed.
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/120527/
   Test FAILed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] maropu commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
maropu commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#discussion_r401973733
 
 

 ##########
 File path: sql/core/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveSessionCatalog.scala
 ##########
 @@ -230,22 +230,19 @@ class ResolveSessionCatalog(
 
     case d @ DescribeNamespace(SessionCatalogAndNamespace(_, ns), _) =>
       if (ns.length != 1) {
-        throw new AnalysisException(
-          s"The database name is not valid: ${ns.quoted}")
+        throw new AnalysisException(s"The database name is not valid: ${ns.quoted}")
 
 Review comment:
   Ur, sorry, but I suggested in my earlier review: https://github.com/apache/spark/pull/27897#discussion_r392563339
   Yea, as you said here, better not to touch these lines in this PR. @Eric5553 Plz revert this? Thanks.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-606960867
 
 
   Merged build finished. Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] Eric5553 commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
Eric5553 commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#discussion_r402369650
 
 

 ##########
 File path: sql/core/src/main/scala/org/apache/spark/sql/execution/command/views.scala
 ##########
 @@ -295,6 +295,41 @@ case class AlterViewAsCommand(
   }
 }
 
+/**
+ * A command for users to get views in the given database.
+ * If a databaseName is not given, the current database will be used.
+ * The syntax of using this command in SQL is:
+ * {{{
+ *   SHOW VIEWS [(IN|FROM) database_name] [[LIKE] 'identifier_with_wildcards'];
+ * }}}
+ */
+case class ShowViewsCommand(
+    databaseName: Option[String],
+    tableIdentifierPattern: Option[String]) extends RunnableCommand {
+
+  // The result of SHOW VIEWS has three basic columns: namespace, viewName and isTemporary.
+  override val output: Seq[Attribute] = Seq(
+    AttributeReference("namespace", StringType, nullable = false)(),
+    AttributeReference("viewName", StringType, nullable = false)(),
+    AttributeReference("isTemporary", BooleanType, nullable = false)())
+
+  override def run(sparkSession: SparkSession): Seq[Row] = {
+    val catalog = sparkSession.sessionState.catalog
+    val db = databaseName.getOrElse(catalog.getCurrentDatabase)
+
+    // Show the information of views.
+    val views = tableIdentifierPattern.map(catalog.listViews(db, _))
+      .getOrElse(catalog.listViews(db, "*"))
+    views.map { tableIdent =>
+      val namespace = tableIdent.database.getOrElse("")
 
 Review comment:
   Yea, I see. updated in 6a4348ed9e289c6ca3cc557f9a575e1829f53fc0. Thanks

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] maropu commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
maropu commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#discussion_r392563652
 
 

 ##########
 File path: sql/core/src/test/resources/sql-tests/results/show-views.sql.out
 ##########
 @@ -0,0 +1,211 @@
+-- Automatically generated by SQLQueryTestSuite
+-- Number of queries: 21
+
+
+-- !query
+CREATE DATABASE showdb
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+USE showdb
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+CREATE TABLE tbl(a String, b Int, c String, d String) USING parquet
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+CREATE VIEW view_1 AS SELECT * FROM tbl
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+CREATE VIEW view_2 AS SELECT * FROM tbl WHERE c='a'
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+CREATE TEMPORARY VIEW view_3(e int) USING parquet
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+CREATE GLOBAL TEMP VIEW view_4 AS SELECT 1 as col1
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+SHOW VIEWS
+-- !query schema
+struct<database:string,viewName:string,isTemporary:boolean>
 
 Review comment:
   This output schema is the same with hive? Can you add some running examples (of Spark and Hive) in the PR description?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-601021249
 
 
   Merged build finished. Test FAILed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-601010152
 
 
   Test PASSed.
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/24743/
   Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-607890248
 
 
   Merged build finished. Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-598581389
 
 
   Test FAILed.
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/119746/
   Test FAILed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] dongjoon-hyun commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#discussion_r401866715
 
 

 ##########
 File path: sql/core/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveSessionCatalog.scala
 ##########
 @@ -230,22 +230,19 @@ class ResolveSessionCatalog(
 
     case d @ DescribeNamespace(SessionCatalogAndNamespace(_, ns), _) =>
       if (ns.length != 1) {
-        throw new AnalysisException(
-          s"The database name is not valid: ${ns.quoted}")
+        throw new AnalysisException(s"The database name is not valid: ${ns.quoted}")
       }
       DescribeDatabaseCommand(ns.head, d.extended)
 
     case AlterNamespaceSetProperties(SessionCatalogAndNamespace(_, ns), properties) =>
       if (ns.length != 1) {
-        throw new AnalysisException(
-          s"The database name is not valid: ${ns.quoted}")
+        throw new AnalysisException(s"The database name is not valid: ${ns.quoted}")
       }
       AlterDatabasePropertiesCommand(ns.head, properties)
 
     case AlterNamespaceSetLocation(SessionCatalogAndNamespace(_, ns), location) =>
       if (ns.length != 1) {
-        throw new AnalysisException(
-          s"The database name is not valid: ${ns.quoted}")
+        throw new AnalysisException(s"The database name is not valid: ${ns.quoted}")
 
 Review comment:
   ditto.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-605544935
 
 
   Test PASSed.
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/25249/
   Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-605544932
 
 
   Merged build finished. Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
SparkQA commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-605373943
 
 
   **[Test build #120520 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/120520/testReport)** for PR 27897 at commit [`522f63b`](https://github.com/apache/spark/commit/522f63b521b70fc0b3de689f45e468bf91092726).

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] maropu commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
maropu commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-599019325
 
 
   Any other system (except for hive) supporting this command?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-609998202
 
 
   Merged build finished. Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] Eric5553 commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
Eric5553 commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-602135066
 
 
   Thanks so much for your help, @dongjoon-hyun! I've rebased #27952 to use `getTablesByType` API and addressed the comment in https://github.com/apache/spark/pull/27952#discussion_r396041969. Thanks!

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-599926045
 
 
   Merged build finished. Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-599855209
 
 
   **[Test build #119904 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/119904/testReport)** for PR 27897 at commit [`dc6e3cb`](https://github.com/apache/spark/commit/dc6e3cb21e5de2a2c591b42014cc03fc4418cca3).

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] maropu commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
maropu commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-600074524
 
 
   The overall looks fine now and anyone can check this? @HyukjinKwon @dongjoon-hyun @cloud-fan 

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-605374088
 
 
   Test PASSed.
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/25226/
   Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] dongjoon-hyun commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-602128152
 
 
   Hi, @Eric5553 and all. #27952 is merged.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] cloud-fan commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#discussion_r397674782
 
 

 ##########
 File path: sql/core/src/main/scala/org/apache/spark/sql/execution/command/views.scala
 ##########
 @@ -295,6 +295,41 @@ case class AlterViewAsCommand(
   }
 }
 
+/**
+ * A command for users to get views in the given database.
+ * If a databaseName is not given, the current database will be used.
+ * The syntax of using this command in SQL is:
+ * {{{
+ *   SHOW VIEWS [(IN|FROM) database_name] [[LIKE] 'identifier_with_wildcards'];
+ * }}}
+ */
+case class ShowViewsCommand(
+    databaseName: Option[String],
+    tableIdentifierPattern: Option[String]) extends RunnableCommand {
+
+  // The result of SHOW VIEWS has three basic columns: database, viewName and isTemporary.
+  override val output: Seq[Attribute] = Seq(
+    AttributeReference("database", StringType, nullable = false)(),
 
 Review comment:
   shall we follow the new abstraction and call it `namespace`?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] dongjoon-hyun commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-603692651
 
 
   To support this, 3a48ea1fe0 is backported to `branch-3.0` first.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-610626028
 
 
   Merged build finished. Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-599910864
 
 
   Test FAILed.
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/119912/
   Test FAILed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-600438126
 
 
   Test PASSed.
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/24692/
   Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-598573475
 
 
   Merged build finished. Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-600438126
 
 
   Test PASSed.
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/24692/
   Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-605401315
 
 
   Merged build finished. Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-600588940
 
 
   Merged build finished. Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-605105734
 
 
   **[Test build #120504 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/120504/testReport)** for PR 27897 at commit [`d14b4fa`](https://github.com/apache/spark/commit/d14b4fa698873cf0eef4f1ca50b9a501c5cd868e).

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-601021342
 
 
   Merged build finished. Test FAILed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-601021252
 
 
   Test FAILed.
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/120025/
   Test FAILed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
SparkQA commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-608051040
 
 
   **[Test build #120729 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/120729/testReport)** for PR 27897 at commit [`6a4348e`](https://github.com/apache/spark/commit/6a4348ed9e289c6ca3cc557f9a575e1829f53fc0).
    * 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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-602533048
 
 
   Test PASSed.
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/24911/
   Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
SparkQA commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-602129162
 
 
   **[Test build #120138 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/120138/testReport)** for PR 27897 at commit [`9ce0564`](https://github.com/apache/spark/commit/9ce0564a24285442fe6088d2044b802b4b7e39e1).

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-605468294
 
 
   Merged build finished. Test FAILed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-605374085
 
 
   Merged build finished. Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] Eric5553 commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
Eric5553 commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#discussion_r402369650
 
 

 ##########
 File path: sql/core/src/main/scala/org/apache/spark/sql/execution/command/views.scala
 ##########
 @@ -295,6 +295,41 @@ case class AlterViewAsCommand(
   }
 }
 
+/**
+ * A command for users to get views in the given database.
+ * If a databaseName is not given, the current database will be used.
+ * The syntax of using this command in SQL is:
+ * {{{
+ *   SHOW VIEWS [(IN|FROM) database_name] [[LIKE] 'identifier_with_wildcards'];
+ * }}}
+ */
+case class ShowViewsCommand(
+    databaseName: Option[String],
+    tableIdentifierPattern: Option[String]) extends RunnableCommand {
+
+  // The result of SHOW VIEWS has three basic columns: namespace, viewName and isTemporary.
+  override val output: Seq[Attribute] = Seq(
+    AttributeReference("namespace", StringType, nullable = false)(),
+    AttributeReference("viewName", StringType, nullable = false)(),
+    AttributeReference("isTemporary", BooleanType, nullable = false)())
+
+  override def run(sparkSession: SparkSession): Seq[Row] = {
+    val catalog = sparkSession.sessionState.catalog
+    val db = databaseName.getOrElse(catalog.getCurrentDatabase)
+
+    // Show the information of views.
+    val views = tableIdentifierPattern.map(catalog.listViews(db, _))
+      .getOrElse(catalog.listViews(db, "*"))
+    views.map { tableIdent =>
+      val namespace = tableIdent.database.getOrElse("")
 
 Review comment:
   I see, updated in 6a4348ed9e289c6ca3cc557f9a575e1829f53fc0.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-607461554
 
 
   Merged build finished. Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
SparkQA commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-610625170
 
 
   **[Test build #120922 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/120922/testReport)** for PR 27897 at commit [`f6132c0`](https://github.com/apache/spark/commit/f6132c0e40e8cd20ed9620f27ad5ba0983891a3f).
    * 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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-602559260
 
 
   Test PASSed.
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/24914/
   Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-605544835
 
 
   **[Test build #120543 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/120543/testReport)** for PR 27897 at commit [`ed66d4e`](https://github.com/apache/spark/commit/ed66d4e496be77b8089b9c5ab59c825923987173).

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] juliuszsompolski commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
juliuszsompolski commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-602519201
 
 
   Thank you for this PR implementing `SHOW VIEWS`! It comes at a handy moment, as we discovered that without `SHOW VIEWS`, Simba ODBC driver implementation of `SQLGetTables` break with Hive 2.3 profile.
   Simba ODBC drivers implemented a workaround because of missing implementation of `GetTablesOperation` in Spark 2.4 and below, where they implemented `SQLGetTables` using `SHOW SCHEMAS`, `SHOW TABLES` and `SHOW VIEWS`.
   They base the capability to issue `SHOW VIEWS` on Hive version (which they obtain via `set -v`). When we switch to Hive 2.3 profile, Simba driver assumes that `SHOW VIEWS` is supported, and issues it, failing the `SQLGetTables` call when it fails.
   Because of this issue, Tableau and PowerBI, which use the Simba ODBC driver, do not work with Spark 3.0 with Hive 2.3.
   Simba is working on a fix, to use the proper `SparkGetTablesOperation` that was implemented for 3.0, instead of the workaround they do now, but it will take some time, plus then it would take some time for vendors such as Tableau and PowerBI to pick up the new drivers...
   
   For the reasons above, would it be possible to get `SHOW VIEWS` into Spark 3.0, so at launch it is not broken with Tableau and PowerBI?
   WDYT @wangyum @gatorsmile @cloud-fan @maropu @dongjoon-hyun ?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-605401318
 
 
   Test PASSed.
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/120520/
   Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] Eric5553 commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
Eric5553 commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#discussion_r392008039
 
 

 ##########
 File path: sql/catalyst/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBase.g4
 ##########
 @@ -174,7 +174,7 @@ statement
         SET TBLPROPERTIES tablePropertyList                            #setTableProperties
     | ALTER (TABLE | VIEW) multipartIdentifier
         UNSET TBLPROPERTIES (IF EXISTS)? tablePropertyList             #unsetTableProperties
-    |ALTER TABLE table=multipartIdentifier
+    | ALTER TABLE table=multipartIdentifier
 
 Review comment:
   fix indent

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] maropu commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
maropu commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-599924015
 
 
   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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-598526394
 
 
   Test PASSed.
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/24467/
   Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] Eric5553 commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
Eric5553 commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#discussion_r394414248
 
 

 ##########
 File path: sql/hive/src/main/scala/org/apache/spark/sql/hive/client/HiveShim.scala
 ##########
 @@ -363,6 +370,15 @@ private[client] class Shim_v0_12 extends Shim with Logging {
     conf.getIntVar(HiveConf.ConfVars.METASTORE_CLIENT_CONNECT_RETRY_DELAY) * 1000L
   }
 
+  override def getTablesByType(
+      hive: Hive,
+      dbName: String,
+      pattern: String,
+      tableType: TableType): Seq[String] = {
+    throw new UnsupportedOperationException("Hive 2.2 and lower versions don't support " +
 
 Review comment:
   Yea, I'll implement that way instead of throwing exception. Thanks!

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] maropu commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
maropu commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#discussion_r392731487
 
 

 ##########
 File path: sql/core/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveSessionCatalog.scala
 ##########
 @@ -530,6 +523,16 @@ class ResolveSessionCatalog(
         replace,
         viewType)
 
+    case ShowViewsStatement(SessionCatalogAndNamespace(_, ns), pattern) =>
+      val namespace = if (ns.isEmpty) {
+        None
+      } else if (ns.length == 1) {
+        Some(ns.head)
+      } else {
+        throw new AnalysisException(s"The database name is not valid: ${ns.quoted}")
 
 Review comment:
   Plz add tests for the multi-part case.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-599855524
 
 
   Merged build finished. Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
SparkQA commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-608267504
 
 
   **[Test build #120746 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/120746/testReport)** for PR 27897 at commit [`1334a03`](https://github.com/apache/spark/commit/1334a035a6b02549c657d8e343b63d683bb2ee9f).
    * This patch **fails due to an unknown error code, -9**.
    * 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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-605106546
 
 
   Merged build finished. Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] Eric5553 commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
Eric5553 commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#discussion_r399403252
 
 

 ##########
 File path: sql/core/src/main/scala/org/apache/spark/sql/execution/command/views.scala
 ##########
 @@ -295,6 +295,41 @@ case class AlterViewAsCommand(
   }
 }
 
+/**
+ * A command for users to get views in the given database.
+ * If a databaseName is not given, the current database will be used.
+ * The syntax of using this command in SQL is:
+ * {{{
+ *   SHOW VIEWS [(IN|FROM) database_name] [[LIKE] 'identifier_with_wildcards'];
+ * }}}
+ */
+case class ShowViewsCommand(
+    databaseName: Option[String],
+    tableIdentifierPattern: Option[String]) extends RunnableCommand {
+
+  // The result of SHOW VIEWS has three basic columns: database, viewName and isTemporary.
+  override val output: Seq[Attribute] = Seq(
+    AttributeReference("database", StringType, nullable = false)(),
 
 Review comment:
   Updated in d14b4fa698873cf0eef4f1ca50b9a501c5cd868e, thanks!

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-607600424
 
 
   Test PASSed.
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/25405/
   Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
SparkQA commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-600418876
 
 
   **[Test build #119962 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/119962/testReport)** for PR 27897 at commit [`475f21e`](https://github.com/apache/spark/commit/475f21e248f9102e93263c75d7f2ef710fe4c9e1).

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] dongjoon-hyun commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#discussion_r393952201
 
 

 ##########
 File path: sql/hive/src/main/scala/org/apache/spark/sql/hive/client/HiveShim.scala
 ##########
 @@ -1220,7 +1236,24 @@ private[client] class Shim_v2_1 extends Shim_v2_0 {
 
 private[client] class Shim_v2_2 extends Shim_v2_1
 
-private[client] class Shim_v2_3 extends Shim_v2_1
+private[client] class Shim_v2_3 extends Shim_v2_1 {
+  private lazy val getTablesByTypeMethod =
+    findMethod(
+      classOf[Hive],
+      "getTablesByType",
+      classOf[String],
+      classOf[String],
+      classOf[TableType])
 
 Review comment:
   BTW, did you test this API on JDK11?
   Like SPARK-29245, the remote invocation should be tested manually.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
SparkQA commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-608337569
 
 
   **[Test build #120755 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/120755/testReport)** for PR 27897 at commit [`3073255`](https://github.com/apache/spark/commit/3073255f6441ef45e8821a458f749f0b3837b18c).
    * 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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-608337807
 
 
   Test FAILed.
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/120755/
   Test FAILed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] cloud-fan commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#discussion_r401078298
 
 

 ##########
 File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/statements.scala
 ##########
 @@ -343,6 +343,15 @@ case class ShowTableStatement(
     partitionSpec: Option[TablePartitionSpec])
   extends ParsedStatement
 
+/**
+ * A SHOW VIEWS statement, as parsed from SQL.
+ */
+case class ShowViewsStatement(
 
 Review comment:
   Let's not add the view APIs for now, as it needs more design work. And seems like we need a v1 version as there is no view in v2 api.
   
   So my suggestion is:
   1. have the v2 style `ShowViews`, without the physical plan as v2 catalog doesn't have view
   2. in `ResolveSessionCatalog`, catch `ShowViews` and fail if the catalog is not a session catalog. Otherwise, convert it v1 style `ShowViewsCommand`.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] cloud-fan commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-608270674
 
 
   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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-598581389
 
 
   Test FAILed.
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/119746/
   Test FAILed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-608565351
 
 
   Merged build finished. Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] dongjoon-hyun commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#discussion_r401872874
 
 

 ##########
 File path: sql/core/src/main/scala/org/apache/spark/sql/execution/HiveResult.scala
 ##########
 @@ -50,6 +50,10 @@ object HiveResult {
     // namespace and table name.
     case command : ShowTablesExec =>
       command.executeCollect().map(_.getString(1))
+    // SHOW VIEWS in Hive only output table names while our v1 command outputs
+    // namespace, table name, isTemp.
 
 Review comment:
   `, isTemp.` -> `, and isTemp.`?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-607661983
 
 
   Merged build finished. Test FAILed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] maropu commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
maropu commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#discussion_r393459810
 
 

 ##########
 File path: sql/hive/src/main/scala/org/apache/spark/sql/hive/client/HiveClientImpl.scala
 ##########
 @@ -755,6 +755,10 @@ private[hive] class HiveClientImpl(
     client.getTablesByPattern(dbName, pattern).asScala
   }
 
+  override def listViews(dbName: String, pattern: String): Seq[String] = withHiveState {
+    shim.getTablesByType(client, dbName, pattern, HiveTableType.VIRTUAL_VIEW)
+  }
 
 Review comment:
   Yea and I think the added ones are good enough.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
SparkQA commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-606960582
 
 
   **[Test build #120657 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/120657/testReport)** for PR 27897 at commit [`90d7019`](https://github.com/apache/spark/commit/90d70196de70b7a93b01e188fda85682a65dc24e).

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-602149990
 
 
   Test PASSed.
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/120138/
   Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] maropu commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
maropu commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#discussion_r392727981
 
 

 ##########
 File path: sql/core/src/test/resources/sql-tests/inputs/show-tables.sql
 ##########
 @@ -15,6 +15,7 @@ SHOW TABLES IN showdb;
 SHOW TABLES 'show_t*';
 SHOW TABLES LIKE 'show_t1*|show_t2*';
 SHOW TABLES IN showdb 'show_t*';
+SHOW TABLES IN showdb LIKE 'show_t*';
 
 Review comment:
   Thanks for adding this test.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-601021355
 
 
   Merged build finished. Test FAILed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] cloud-fan commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#discussion_r392824410
 
 

 ##########
 File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/statements.scala
 ##########
 @@ -343,6 +343,15 @@ case class ShowTableStatement(
     partitionSpec: Option[TablePartitionSpec])
   extends ParsedStatement
 
+/**
+ * A SHOW VIEWS statement, as parsed from SQL.
+ */
+case class ShowViewsStatement(
 
 Review comment:
   can we follow how we implement `SHOW TABLES`?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-599855524
 
 
   Merged build finished. Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] cloud-fan commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#discussion_r402067498
 
 

 ##########
 File path: sql/core/src/main/scala/org/apache/spark/sql/execution/command/views.scala
 ##########
 @@ -295,6 +295,41 @@ case class AlterViewAsCommand(
   }
 }
 
+/**
+ * A command for users to get views in the given database.
+ * If a databaseName is not given, the current database will be used.
+ * The syntax of using this command in SQL is:
+ * {{{
+ *   SHOW VIEWS [(IN|FROM) database_name] [[LIKE] 'identifier_with_wildcards'];
+ * }}}
+ */
+case class ShowViewsCommand(
+    databaseName: Option[String],
+    tableIdentifierPattern: Option[String]) extends RunnableCommand {
+
+  // The result of SHOW VIEWS has three basic columns: namespace, viewName and isTemporary.
+  override val output: Seq[Attribute] = Seq(
+    AttributeReference("namespace", StringType, nullable = false)(),
+    AttributeReference("viewName", StringType, nullable = false)(),
+    AttributeReference("isTemporary", BooleanType, nullable = false)())
+
+  override def run(sparkSession: SparkSession): Seq[Row] = {
+    val catalog = sparkSession.sessionState.catalog
+    val db = databaseName.getOrElse(catalog.getCurrentDatabase)
+
+    // Show the information of views.
+    val views = tableIdentifierPattern.map(catalog.listViews(db, _))
+      .getOrElse(catalog.listViews(db, "*"))
+    views.map { tableIdent =>
+      val namespace = tableIdent.database.getOrElse("")
 
 Review comment:
   How about `tableIdent.database.toSeq.quoted`? We should quote it if the database name has dot, to be consistent with the future v2 command view name.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-602155605
 
 
   Merged build finished. Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
SparkQA commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-600458371
 
 
   **[Test build #119968 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/119968/testReport)** for PR 27897 at commit [`6755904`](https://github.com/apache/spark/commit/675590426be99abdf2802c6b00b7bbe77af797c3).
    * This patch **fails due to an unknown error code, -9**.
    * 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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-599911018
 
 
   Merged build finished. Test FAILed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
SparkQA commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-600985402
 
 
   **[Test build #120023 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/120023/testReport)** for PR 27897 at commit [`6e6d848`](https://github.com/apache/spark/commit/6e6d848a35e3227789f0cffbb7bcbe9fcdf202cb).

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] Eric5553 commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
Eric5553 commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-599083046
 
 
   @maropu Thanks for your review, I'll address them soon!

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] juliuszsompolski commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
juliuszsompolski commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-602543674
 
 
   > It looks like a bug that we don't implement GetTablesOperation correctly in 3.0, as SHOW VIEWS is missing. I'm fine to backport this PR, or we can revert the support of GetTablesOperation. @wangyum what do you think?
   
   We do implement GetTablesOperation correctly in 3.0, just that Simba does not use it yet - but keeps using the workaround they used before. Once Simba fixes it in the drivers to start using the newly implemented GetTablesOperation, the issue will be resolved without SHOW VIEWS.
   
   Simba is working on it and their ETA is to release fixed drivers in mid-April. But then Tableau and PowerBI need to integrate it and release patches - this would add another 4-6 weeks, and then end users have to upgrade, which is another delay.
   Even though it will be fixed on the drivers side, I would propose to back-port SHOW VIEWS just to avoid the breakage for users that don't update the client.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] Eric5553 commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
Eric5553 commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-603605768
 
 
   @dongjoon-hyun @cloud-fan @HyukjinKwon Is there any other comments that I should update? Thanks!

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] dongjoon-hyun commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#discussion_r401866901
 
 

 ##########
 File path: sql/core/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveSessionCatalog.scala
 ##########
 @@ -362,8 +359,7 @@ class ResolveSessionCatalog(
     case c @ CreateNamespaceStatement(CatalogAndNamespace(catalog, ns), _, _)
         if isSessionCatalog(catalog) =>
       if (ns.length != 1) {
-        throw new AnalysisException(
-          s"The database name is not valid: ${ns.quoted}")
+        throw new AnalysisException(s"The database name is not valid: ${ns.quoted}")
 
 Review comment:
   ditto.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-599911018
 
 
   Merged build finished. Test FAILed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-600985695
 
 
   Test PASSed.
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/24741/
   Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-600458541
 
 
   Merged build finished. Test FAILed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-602129496
 
 
   Test PASSed.
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/24852/
   Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-599910858
 
 
   Merged build finished. Test FAILed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-608337797
 
 
   Merged build finished. Test FAILed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
SparkQA commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-602555664
 
 
   **[Test build #120198 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/120198/testReport)** for PR 27897 at commit [`01004a9`](https://github.com/apache/spark/commit/01004a9701ac56f7ed0a7db21972a444a1085039).
    * 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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] dongjoon-hyun commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#discussion_r393932044
 
 

 ##########
 File path: sql/core/src/main/scala/org/apache/spark/sql/execution/command/tables.scala
 ##########
 @@ -869,14 +869,14 @@ case class ShowTablesCommand(
   }
 
   override def run(sparkSession: SparkSession): Seq[Row] = {
-    // Since we need to return a Seq of rows, we will call getTables directly
+    // Since we need to return a Seq of rows, we will call listTables directly
     // instead of calling tables in sparkSession.
     val catalog = sparkSession.sessionState.catalog
     val db = databaseName.getOrElse(catalog.getCurrentDatabase)
     if (partitionSpec.isEmpty) {
       // Show the information of tables.
-      val tables =
-        tableIdentifierPattern.map(catalog.listTables(db, _)).getOrElse(catalog.listTables(db))
+      val tables = tableIdentifierPattern.map(catalog.listTables(db, _))
+        .getOrElse(catalog.listTables(db))
 
 Review comment:
   Please revert this change on this file, @Eric5553 .

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] Eric5553 edited a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
Eric5553 edited a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-600950809
 
 
   A separate PR https://github.com/apache/spark/pull/27952 was opened to focusing on HiveClient related code. 
   For the fallback solution of Hive 2.2- versions that @cloud-fan suggested, I plan to handle it in `HiveExternalCatalog.listViews` rather than `HiveClient.listViews`. So will update here in this PR later. Thanks!
   @maropu @dongjoon-hyun @cloud-fan 

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-598573478
 
 
   Test PASSed.
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/24475/
   Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-605544935
 
 
   Test PASSed.
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/25249/
   Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
SparkQA commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-602149812
 
 
   **[Test build #120138 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/120138/testReport)** for PR 27897 at commit [`9ce0564`](https://github.com/apache/spark/commit/9ce0564a24285442fe6088d2044b802b4b7e39e1).
    * 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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] maropu commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
maropu commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-601053247
 
 
   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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-602555855
 
 
   Test FAILed.
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/120198/
   Test FAILed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-602129162
 
 
   **[Test build #120138 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/120138/testReport)** for PR 27897 at commit [`9ce0564`](https://github.com/apache/spark/commit/9ce0564a24285442fe6088d2044b802b4b7e39e1).

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-602149986
 
 
   Merged build finished. Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-599234907
 
 
   Test PASSed.
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/119817/
   Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] Eric5553 commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
Eric5553 commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#discussion_r399406192
 
 

 ##########
 File path: sql/core/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveSessionCatalog.scala
 ##########
 @@ -530,6 +523,16 @@ class ResolveSessionCatalog(
         replace,
         viewType)
 
+    case ShowViewsStatement(SessionCatalogAndNamespace(_, ns), pattern) =>
 
 Review comment:
   I see, thanks so much for your clarification, @cloud-fan ! `SessionCatalogAndNamespace` is a support function to make sure the resolved catalog is `SessionCatalog`, which supports several V1 commands. So I think maybe we should just throw `AnalysisException` in `SessionCatalogAndNamespace`? WDYT, updated in d14b4fa698873cf0eef4f1ca50b9a501c5cd868e.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] maropu commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
maropu commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#discussion_r392727965
 
 

 ##########
 File path: sql/core/src/test/resources/sql-tests/inputs/show-views.sql
 ##########
 @@ -0,0 +1,28 @@
+-- Test data.
+CREATE DATABASE showdb;
+USE showdb;
+CREATE TABLE tbl(a String, b Int, c String, d String) USING parquet;
+CREATE VIEW view_1 AS SELECT * FROM tbl;
+CREATE VIEW view_2 AS SELECT * FROM tbl WHERE c='a';
+CREATE TEMPORARY VIEW view_3(e int) USING parquet;
+CREATE GLOBAL TEMP VIEW view_4 AS SELECT 1 as col1;
+
+-- SHOW VIEWS
+SHOW VIEWS;
+SHOW VIEWS FROM showdb;
+SHOW VIEWS IN showdb;
+SHOW VIEWS IN global_temp;
+
+-- SHOW VIEWS WITH wildcard match
+SHOW VIEWS 'view_*';
+SHOW VIEWS LIKE 'view_1*|view_2*';
+SHOW VIEWS IN showdb 'view_*';
 
 Review comment:
   Also, plz add tests for the not-found-database case.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-601056280
 
 
   Merged build finished. Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] Eric5553 commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
Eric5553 commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#discussion_r393421062
 
 

 ##########
 File path: sql/core/src/main/scala/org/apache/spark/sql/execution/command/views.scala
 ##########
 @@ -280,6 +280,44 @@ case class AlterViewAsCommand(
   }
 }
 
+/**
+ * A command for users to get views in the given database.
+ * If a databaseName is not given, the current database will be used.
+ * The syntax of using this command in SQL is:
+ * {{{
+ *   SHOW VIEWS [(IN|FROM) database_name] [[LIKE] 'identifier_with_wildcards'];
+ * }}}
+ */
+case class ShowViewsCommand(
+    databaseName: Option[String],
+    tableIdentifierPattern: Option[String]) extends RunnableCommand {
+
+  // The result of SHOW TABLES/SHOW TABLE has three basic columns: database, tableName and
+  // isTemporary. If `isExtended` is true, append column `information` to the output columns.
 
 Review comment:
   Oops, my mistake. Updated in dc6e3cb21e5de2a2c591b42014cc03fc4418cca3.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-605462918
 
 
   Merged build finished. Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-608220952
 
 
   **[Test build #120750 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/120750/testReport)** for PR 27897 at commit [`7bd9cc6`](https://github.com/apache/spark/commit/7bd9cc662528a7fcfdb1f07b6565a0e6cac8512a).

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-608200824
 
 
   **[Test build #120746 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/120746/testReport)** for PR 27897 at commit [`1334a03`](https://github.com/apache/spark/commit/1334a035a6b02549c657d8e343b63d683bb2ee9f).

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-608267722
 
 
   Test FAILed.
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/120750/
   Test FAILed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
HyukjinKwon commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#discussion_r394766551
 
 

 ##########
 File path: sql/hive/src/main/scala/org/apache/spark/sql/hive/client/HiveShim.scala
 ##########
 @@ -363,6 +370,15 @@ private[client] class Shim_v0_12 extends Shim with Logging {
     conf.getIntVar(HiveConf.ConfVars.METASTORE_CLIENT_CONNECT_RETRY_DELAY) * 1000L
   }
 
+  override def getTablesByType(
+      hive: Hive,
+      dbName: String,
+      pattern: String,
+      tableType: TableType): Seq[String] = {
+    throw new UnsupportedOperationException("Hive 2.2 and lower versions don't support " +
 
 Review comment:
   Can we implement without adding the method in `HiveShim` first, and improve with using `listTables`? Seems like it's not a must given my reading. Adding a method here requires to test in multiple profiles with multiple versions.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-600987654
 
 
   Test PASSed.
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/24742/
   Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
SparkQA commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-600437743
 
 
   **[Test build #119968 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/119968/testReport)** for PR 27897 at commit [`6755904`](https://github.com/apache/spark/commit/675590426be99abdf2802c6b00b7bbe77af797c3).

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-600418876
 
 
   **[Test build #119962 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/119962/testReport)** for PR 27897 at commit [`475f21e`](https://github.com/apache/spark/commit/475f21e248f9102e93263c75d7f2ef710fe4c9e1).

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
SparkQA commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-607661646
 
 
   **[Test build #120707 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/120707/testReport)** for PR 27897 at commit [`55a5997`](https://github.com/apache/spark/commit/55a5997bdfe34439a171d3603fc98975b7c18129).
    * This patch **fails due to an unknown error code, -9**.
    * 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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] dongjoon-hyun commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#discussion_r404415933
 
 

 ##########
 File path: sql/core/src/main/scala/org/apache/spark/sql/execution/HiveResult.scala
 ##########
 @@ -50,6 +50,10 @@ object HiveResult {
     // namespace and table name.
     case command : ShowTablesExec =>
       command.executeCollect().map(_.getString(1))
+    // SHOW VIEWS in Hive only outputs table names while our v1 command outputs
+    // namespace, table name, and isTemp.
 
 Review comment:
   `table name` -> `view name`?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-607600424
 
 
   Test PASSed.
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/25405/
   Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
SparkQA commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-608272524
 
 
   **[Test build #120756 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/120756/testReport)** for PR 27897 at commit [`6d68ec4`](https://github.com/apache/spark/commit/6d68ec46f410ad697353cf1c6e9bf833171a5222).

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-601186239
 
 
   Test PASSed.
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/120040/
   Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] dongjoon-hyun commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#discussion_r393945350
 
 

 ##########
 File path: sql/core/src/test/resources/sql-tests/inputs/show-views.sql
 ##########
 @@ -0,0 +1,31 @@
+-- Test data.
+CREATE DATABASE showdb;
+USE showdb;
+CREATE TABLE tbl(a String, b Int, c String, d String) USING parquet;
+CREATE VIEW view_1 AS SELECT * FROM tbl;
+CREATE VIEW view_2 AS SELECT * FROM tbl WHERE c='a';
+CREATE TEMPORARY VIEW view_3(e int) USING parquet;
+CREATE GLOBAL TEMP VIEW view_4 AS SELECT 1 as col1;
 
 Review comment:
   BTW, please switch line 7 and 8. In this PR, global temp view (`view_4`) is printed out before local temp view (`view_3`).

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-602155607
 
 
   Test PASSed.
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/120145/
   Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-599205027
 
 
   Test PASSed.
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/24547/
   Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
SparkQA commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-609997177
 
 
   **[Test build #120878 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/120878/testReport)** for PR 27897 at commit [`069fbc1`](https://github.com/apache/spark/commit/069fbc1281565eb41e2bc6829a895f93e6af0409).
    * 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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] dongjoon-hyun commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#discussion_r393916049
 
 

 ##########
 File path: docs/sql-ref-syntax-aux-show-views.md
 ##########
 @@ -0,0 +1,125 @@
+---
+layout: global
+title: SHOW VIEWS
+displayTitle: SHOW VIEWS
+license: |
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+ 
+     http://www.apache.org/licenses/LICENSE-2.0
+ 
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+---
+### Description
+
+The `SHOW VIEWS` statement returns all the views for an optionally specified database.
+Additionally, the output of this statement may be filtered by an optional matching
+pattern. If no database is specified then the views are returned from the 
+current database. Note that the command always lists global and temporary views 
+regardless of a given database.
+
+### Syntax
+{% highlight sql %}
+SHOW VIEWS [ { FROM | IN } database_name ] [ LIKE 'regex_pattern' ]
+{% endhighlight %}
+
+### Parameters
+<dl>
+  <dt><code><em>{ FROM | IN } database_name</em></code></dt>
+  <dd>
+     Specifies the database name from which views are listed.
+  </dd>
+  <dt><code><em>LIKE regex_pattern</em></code></dt>
+  <dd>
+     Specifies the regular expression pattern that is used to filter out unwanted views. 
+     <ul> 
+          <li> Except for `*` and `|` character, the pattern works like a regex.</li>
+          <li> `*` alone matches 0 or more characters and `|` is used to separate multiple different regexes,
+           any of which can match. </li>
+          <li> The leading and trailing blanks are trimmed in the input pattern before processing.</li>
+     </ul>
+    
+  </dd>
+</dl>
+
+### Example
+{% highlight sql %}
+-- Create views in different databases, also create global/local temp views.
+CREATE VIEW sam AS SELECT id, salary FROM employee WHERE name = 'sam';
+CREATE VIEW sam1 AS SELECT id, salary FROM employee WHERE name = 'sam1';
+CREATE VIEW suj AS SELECT id, salary FROM employee WHERE name = 'suj';
+USE userdb;
+CREATE VIEW user1 AS SELECT id, salary FROM employee WHERE name = 'user1';
+CREATE VIEW user2 AS SELECT id, salary FROM employee WHERE name = 'user2';
+USE default;
+CREATE GLOBAL TEMP VIEW temp1 AS SELECT 1 as col1;
+CREATE TEMP VIEW temp2 AS SELECT 1 as col1;
+
+-- List all views in default database
+SHOW VIEWS;
+  +-------------+------------+--------------+--+
+  | database    | viewName   | isTemporary  |
+  +-------------+------------+--------------+--+
+  | default     | sam        | false        |
+  | default     | sam1       | false        |
+  | default     | suj        | false        |
+  | global_temp | temp1      | true         |
+  |             | temp2      | true         |
+  +-------------+------------+--------------+--+
+
+-- List all views from userdb database 
+SHOW VIEWS FROM userdb;
+  +-------------+------------+--------------+--+
+  | database    | viewName   | isTemporary  |
+  +-------------+------------+--------------+--+
+  | userdb      | user1      | false        |
+  | userdb      | user2      | false        |
+  | global_temp | temp1      | true         |
+  |             | temp2      | true         |
+  +-------------+------------+--------------+--+
+
+-- List all views in userdb database
+SHOW VIEWS IN userdb;
+  +-------------+------------+--------------+--+
+  | database    | viewName   | isTemporary  |
+  +-------------+------------+--------------+--+
+  | userdb      | user1      | false        |
+  | userdb      | user2      | false        |
+  | global_temp | temp1      | true         |
+  |             | temp2      | true         |
+  +-------------+------------+--------------+--+
+
+-- List all views from default database matching the pattern `sam*`
+SHOW VIEWS FROM default LIKE 'sam*';
+  +-----------+------------+--------------+--+
+  | database  | viewName   | isTemporary  |
+  +-----------+------------+--------------+--+
+  | default   | sam        | false        |
+  | default   | sam1       | false        |
+  +-----------+------------+--------------+--+
+  
+-- List all views matching the pattern `sam*|suj`
+SHOW VIEWS LIKE 'sam*|suj';
 
 Review comment:
   Shall we have `sam|suj|temp*` instead? Then, we can show the pattern matching on local and global temp views, too.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-605434260
 
 
   Test PASSed.
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/25233/
   Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] dongjoon-hyun commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#discussion_r393945350
 
 

 ##########
 File path: sql/core/src/test/resources/sql-tests/inputs/show-views.sql
 ##########
 @@ -0,0 +1,31 @@
+-- Test data.
+CREATE DATABASE showdb;
+USE showdb;
+CREATE TABLE tbl(a String, b Int, c String, d String) USING parquet;
+CREATE VIEW view_1 AS SELECT * FROM tbl;
+CREATE VIEW view_2 AS SELECT * FROM tbl WHERE c='a';
+CREATE TEMPORARY VIEW view_3(e int) USING parquet;
+CREATE GLOBAL TEMP VIEW view_4 AS SELECT 1 as col1;
 
 Review comment:
   BTW, please switch line 7 and 8. In this PR, global temp view (`view_4`) is printed out before local temp view (`view_3`). Although our test suite did sort and hide it.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-602555841
 
 
   Merged build finished. Test FAILed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-607890263
 
 
   Test PASSed.
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/25427/
   Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-598581383
 
 
   Merged build finished. Test FAILed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] dongjoon-hyun commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-610466593
 
 
   Thank you so much for sharing, @juliuszsompolski !

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] dongjoon-hyun commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#discussion_r393954458
 
 

 ##########
 File path: sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveCommandSuite.scala
 ##########
 @@ -117,6 +117,51 @@ class HiveCommandSuite extends QueryTest with SQLTestUtils with TestHiveSingleto
     }
   }
 
+  test("show views") {
+    withView("default1a", "default2b", "temp1", "global_temp.temp2") {
+      sql("CREATE VIEW show1a AS SELECT 1 AS id")
+      sql("CREATE VIEW show2b AS SELECT 1 AS id")
+      sql("CREATE TEMP VIEW temp1 AS SELECT 1 AS id")
+      sql("CREATE GLOBAL TEMP VIEW temp2 AS SELECT 1 AS id")
 
 Review comment:
   Switch line 125 and 124 and the names `temp1` and `temp2`.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-598632473
 
 
   Test PASSed.
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/24481/
   Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
SparkQA commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-598722433
 
 
   **[Test build #119752 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/119752/testReport)** for PR 27897 at commit [`4a5ccbb`](https://github.com/apache/spark/commit/4a5ccbb3cedca31543158fd116912510a4eabf6b).
    * 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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] dongjoon-hyun commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#discussion_r404415711
 
 

 ##########
 File path: sql/core/src/main/scala/org/apache/spark/sql/execution/HiveResult.scala
 ##########
 @@ -50,6 +50,10 @@ object HiveResult {
     // namespace and table name.
     case command : ShowTablesExec =>
       command.executeCollect().map(_.getString(1))
+    // SHOW VIEWS in Hive only outputs table names while our v1 command outputs
+    // namespace, table name, and isTemp.
 
 Review comment:
   nit. `table name` -> `view name`.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-605401315
 
 
   Merged build finished. Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] Eric5553 commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
Eric5553 commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#discussion_r399402971
 
 

 ##########
 File path: docs/sql-ref-syntax-aux-show-views.md
 ##########
 @@ -0,0 +1,125 @@
+---
+layout: global
+title: SHOW VIEWS
+displayTitle: SHOW VIEWS
+license: |
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+ 
+     http://www.apache.org/licenses/LICENSE-2.0
+ 
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+---
+### Description
+
+The `SHOW VIEWS` statement returns all the views for an optionally specified database.
+Additionally, the output of this statement may be filtered by an optional matching
+pattern. If no database is specified then the views are returned from the 
+current database. Note that the command always lists global and temporary views 
+regardless of a given database.
+
+### Syntax
+{% highlight sql %}
+SHOW VIEWS [ { FROM | IN } database_name ] [ LIKE 'regex_pattern' ]
+{% endhighlight %}
+
+### Parameters
+<dl>
+  <dt><code><em>{ FROM | IN } database_name</em></code></dt>
+  <dd>
+     Specifies the database name from which views are listed.
+  </dd>
+  <dt><code><em>LIKE regex_pattern</em></code></dt>
+  <dd>
+     Specifies the regular expression pattern that is used to filter out unwanted views. 
+     <ul> 
+          <li> Except for `*` and `|` character, the pattern works like a regex.</li>
+          <li> `*` alone matches 0 or more characters and `|` is used to separate multiple different regexes,
+           any of which can match. </li>
+          <li> The leading and trailing blanks are trimmed in the input pattern before processing.</li>
+     </ul>
+  </dd>
+</dl>
+
+### Example
+{% highlight sql %}
+-- Create views in different databases, also create global/local temp views.
+CREATE VIEW sam AS SELECT id, salary FROM employee WHERE name = 'sam';
+CREATE VIEW sam1 AS SELECT id, salary FROM employee WHERE name = 'sam1';
+CREATE VIEW suj AS SELECT id, salary FROM employee WHERE name = 'suj';
+USE userdb;
+CREATE VIEW user1 AS SELECT id, salary FROM employee WHERE name = 'user1';
+CREATE VIEW user2 AS SELECT id, salary FROM employee WHERE name = 'user2';
+USE default;
+CREATE GLOBAL TEMP VIEW temp1 AS SELECT 1 as col1;
+CREATE TEMP VIEW temp2 AS SELECT 1 as col1;
+
+-- List all views in default database
+SHOW VIEWS;
+  +-------------+------------+--------------+--+
+  | database    | viewName   | isTemporary  |
+  +-------------+------------+--------------+--+
+  | default     | sam        | false        |
+  | default     | sam1       | false        |
+  | default     | suj        | false        |
+  | global_temp | temp1      | true         |
 
 Review comment:
   Thanks for your suggestions! Updated in d14b4fa698873cf0eef4f1ca50b9a501c5cd868e.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-600458494
 
 
   Merged build finished. Test FAILed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] cloud-fan commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#discussion_r394391663
 
 

 ##########
 File path: sql/hive/src/main/scala/org/apache/spark/sql/hive/client/HiveShim.scala
 ##########
 @@ -363,6 +370,15 @@ private[client] class Shim_v0_12 extends Shim with Logging {
     conf.getIntVar(HiveConf.ConfVars.METASTORE_CLIENT_CONNECT_RETRY_DELAY) * 1000L
   }
 
+  override def getTablesByType(
+      hive: Hive,
+      dbName: String,
+      pattern: String,
+      tableType: TableType): Seq[String] = {
+    throw new UnsupportedOperationException("Hive 2.2 and lower versions don't support " +
 
 Review comment:
   Shall we fallback to `listTables` and then filter by table type? It's weird if SHOW VIEWS only works for hive 2.3+

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-607889396
 
 
   **[Test build #120729 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/120729/testReport)** for PR 27897 at commit [`6a4348e`](https://github.com/apache/spark/commit/6a4348ed9e289c6ca3cc557f9a575e1829f53fc0).

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-599205026
 
 
   Merged build finished. Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] maropu commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
maropu commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#discussion_r392732416
 
 

 ##########
 File path: sql/core/src/main/scala/org/apache/spark/sql/execution/command/views.scala
 ##########
 @@ -280,6 +280,44 @@ case class AlterViewAsCommand(
   }
 }
 
+/**
+ * A command for users to get views in the given database.
+ * If a databaseName is not given, the current database will be used.
+ * The syntax of using this command in SQL is:
+ * {{{
+ *   SHOW VIEWS [(IN|FROM) database_name] [[LIKE] 'identifier_with_wildcards'];
+ * }}}
+ */
+case class ShowViewsCommand(
+    databaseName: Option[String],
+    tableIdentifierPattern: Option[String]) extends RunnableCommand {
+
+  // The result of SHOW TABLES/SHOW TABLE has three basic columns: database, tableName and
+  // isTemporary. If `isExtended` is true, append column `information` to the output columns.
+  override val output: Seq[Attribute] = Seq(
+    AttributeReference("database", StringType, nullable = false)(),
+    AttributeReference("viewName", StringType, nullable = false)(),
+    AttributeReference("isTemporary", BooleanType, nullable = false)())
+
+  override def run(sparkSession: SparkSession): Seq[Row] = {
+    // Since we need to return a Seq of rows, we will call getTables directly
+    // instead of calling tables in sparkSession.
 
 Review comment:
   btw, in the original comment in `ShowTablesCommand`, `getTable` -> `listTables`?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-602533048
 
 
   Test PASSed.
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/24911/
   Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-607314573
 
 
   Merged build finished. Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-608221321
 
 
   Test PASSed.
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/25449/
   Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-601056289
 
 
   Test PASSed.
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/24759/
   Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-600987654
 
 
   Test PASSed.
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/24742/
   Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] maropu commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
maropu commented on a change in pull request #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#discussion_r392732512
 
 

 ##########
 File path: sql/core/src/main/scala/org/apache/spark/sql/execution/command/views.scala
 ##########
 @@ -280,6 +280,44 @@ case class AlterViewAsCommand(
   }
 }
 
+/**
+ * A command for users to get views in the given database.
+ * If a databaseName is not given, the current database will be used.
+ * The syntax of using this command in SQL is:
+ * {{{
+ *   SHOW VIEWS [(IN|FROM) database_name] [[LIKE] 'identifier_with_wildcards'];
+ * }}}
+ */
+case class ShowViewsCommand(
+    databaseName: Option[String],
+    tableIdentifierPattern: Option[String]) extends RunnableCommand {
+
+  // The result of SHOW TABLES/SHOW TABLE has three basic columns: database, tableName and
+  // isTemporary. If `isExtended` is true, append column `information` to the output columns.
+  override val output: Seq[Attribute] = Seq(
+    AttributeReference("database", StringType, nullable = false)(),
+    AttributeReference("viewName", StringType, nullable = false)(),
+    AttributeReference("isTemporary", BooleanType, nullable = false)())
+
+  override def run(sparkSession: SparkSession): Seq[Row] = {
+    // Since we need to return a Seq of rows, we will call getTables directly
+    // instead of calling tables in sparkSession.
+    val catalog = sparkSession.sessionState.catalog
+    val db = databaseName.getOrElse(catalog.getCurrentDatabase)
+
+    // Show the information of views.
+    val views =
 
 Review comment:
   nit style;
   ```
       val views = tableIdentifierPattern.map(catalog.listViews(db, _))
         .getOrElse(catalog.listViews(db, "*"))
   ```

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
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 issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-600474261
 
 
   Test PASSed.
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/24699/
   Test PASSed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command

Posted by GitBox <gi...@apache.org>.
SparkQA commented on issue #27897: [SPARK-31113][SQL] Add SHOW VIEWS command
URL: https://github.com/apache/spark/pull/27897#issuecomment-600046004
 
 
   **[Test build #119925 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/119925/testReport)** for PR 27897 at commit [`1d56c0e`](https://github.com/apache/spark/commit/1d56c0e4fbe9a26232d6856a253371d16f24d4da).
    * 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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org