Michael Smith has submitted this change and it was merged. ( 
http://gerrit.cloudera.org:8080/20669 )

Change subject: IMPALA-3268: Add support for SHOW VIEWS statement
......................................................................

IMPALA-3268: Add support for SHOW VIEWS statement

This patch adds the support for the SHOW VIEWS statement and does not
change the current behavior of the SHOW TABLES statement. It is
recommended that we start the catalog server with
'--pull_table_types_and_comments=true' when executing this command
so that the table type of every Table is always available.

Specifically, after this patch, a user will be able to retrieve from
Impala the names of the Table's whose getTableType() evaluate to
TImpalaTableType.VIEW that match an optional pattern.

Similar to the SHOW TABLES statement, the following are supported
after this patch.
1. SHOW VIEWS.
2. SHOW VIEWS "<P1>|<P2>|<P3>", where <PN> denotes the N-th pattern,
   "|" denotes choice and each pattern may contain wildcards denoted by
   "*".
3. SHOW VIEWS IN <db>, where <db> denotes the name of a database.
Refer to the added end-to-end test cases for further details.

Recall that Hive distinguishes materialized views from views. To align
Impala's behavior with that of Hive with respect to the SHOW VIEWS
statement, in this patch we introduce
TImpalaTableType.MATERIALIZED_VIEW as a table type that corresponds to
the table type of 'MATERIALIZED_VIEW' for a
org.apache.hadoop.hive.metastore.api.Table. Due to this we have to
revise the mappings from Hive's table types to Impala's table types in
various places and have to slightly modify the logic used to
instantiate a table with an appropriate type.

Testing:
 - Added various frontend and end-to-end tests to verify the behavior
   of the SHOW VIEWS statement.

Change-Id: I321fc5350392a815949a4e7d2a64d60466689788
Reviewed-on: http://gerrit.cloudera.org:8080/20669
Reviewed-by: Quanlong Huang <[email protected]>
Tested-by: Michael Smith <[email protected]>
---
M be/src/service/client-request-state.cc
M be/src/service/frontend.cc
M be/src/service/frontend.h
M common/thrift/CatalogObjects.thrift
M common/thrift/CatalogService.thrift
M common/thrift/Frontend.thrift
M fe/src/main/cup/sql-parser.cup
M fe/src/main/java/org/apache/impala/analysis/AnalysisContext.java
A fe/src/main/java/org/apache/impala/analysis/ShowTablesOrViewsStmt.java
M fe/src/main/java/org/apache/impala/analysis/ShowTablesStmt.java
A fe/src/main/java/org/apache/impala/analysis/ShowViewsStmt.java
M fe/src/main/java/org/apache/impala/catalog/Catalog.java
M fe/src/main/java/org/apache/impala/catalog/Db.java
M fe/src/main/java/org/apache/impala/catalog/FeCatalog.java
M fe/src/main/java/org/apache/impala/catalog/FeDb.java
M fe/src/main/java/org/apache/impala/catalog/Hive3MetastoreShimBase.java
M fe/src/main/java/org/apache/impala/catalog/IncompleteTable.java
M fe/src/main/java/org/apache/impala/catalog/Table.java
M fe/src/main/java/org/apache/impala/catalog/local/LocalCatalog.java
M fe/src/main/java/org/apache/impala/catalog/local/LocalDb.java
M fe/src/main/java/org/apache/impala/service/Frontend.java
M fe/src/main/java/org/apache/impala/service/JniFrontend.java
M fe/src/main/jflex/sql-scanner.flex
M fe/src/test/java/org/apache/impala/analysis/ParserTest.java
M fe/src/test/java/org/apache/impala/analysis/ToSqlTest.java
M fe/src/test/java/org/apache/impala/authorization/AuthorizationStmtTest.java
A testdata/workloads/functional-query/queries/QueryTest/show_views.test
M tests/custom_cluster/test_preload_table_types.py
A tests/custom_cluster/test_show_views_statements.py
29 files changed, 616 insertions(+), 118 deletions(-)

Approvals:
  Quanlong Huang: Looks good to me, approved
  Michael Smith: Verified

--
To view, visit http://gerrit.cloudera.org:8080/20669
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I321fc5350392a815949a4e7d2a64d60466689788
Gerrit-Change-Number: 20669
Gerrit-PatchSet: 12
Gerrit-Owner: Fang-Yu Rao <[email protected]>
Gerrit-Reviewer: Aman Sinha <[email protected]>
Gerrit-Reviewer: Fang-Yu Rao <[email protected]>
Gerrit-Reviewer: Impala Public Jenkins <[email protected]>
Gerrit-Reviewer: Michael Smith <[email protected]>
Gerrit-Reviewer: Quanlong Huang <[email protected]>
Gerrit-Reviewer: Sai Hemanth Gantasala <[email protected]>

Reply via email to