You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@impala.apache.org by "Fang-Yu Rao (Code Review)" <ge...@cloudera.org> on 2023/12/06 00:50:49 UTC

[Impala-ASF-CR] IMPALA-3268: Add support for SHOW VIEWS statement

Hello Quanlong Huang, Aman Sinha, Sai Hemanth Gantasala, Michael Smith, Impala Public Jenkins, 

I'd like you to reexamine a change. Please visit

    http://gerrit.cloudera.org:8080/20669

to look at the new patch set (#11).

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


  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/69/20669/11
-- 
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: newpatchset
Gerrit-Change-Id: I321fc5350392a815949a4e7d2a64d60466689788
Gerrit-Change-Number: 20669
Gerrit-PatchSet: 11
Gerrit-Owner: Fang-Yu Rao <fa...@cloudera.com>
Gerrit-Reviewer: Aman Sinha <am...@cloudera.com>
Gerrit-Reviewer: Fang-Yu Rao <fa...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Michael Smith <mi...@cloudera.com>
Gerrit-Reviewer: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Sai Hemanth Gantasala <sa...@cloudera.com>