Aman Sinha has uploaded this change for review. ( 
http://gerrit.cloudera.org:8080/17595


Change subject: IMPALA-10723: [WIP] Treat materialized view as a table instead 
of a view
......................................................................

IMPALA-10723: [WIP] Treat materialized view as a table instead of a view

The existing behavior is that materialized views are treated
as views and therefore expanded similar to a view when one
queries the MV directly (SELECT * FROM materialized_view).
This is incorrect since an MV is a regular table with physical
properties such as partitioning, clustering etc. and should be
treated as such even though it has a view definition associated
with it.

This patch focuses on the use case where MVs are created as
HDFS tables and makes the MVs a derived class of HdfsTable,
therefore making it a Table object. It adds support for
collecting and displaying statistics on materialized views
and these statistics could be leveraged by an external frontend
that supports MV based query rewrites. Directly querying a MV
is permitted but inserts into MVs is not since MVs are supposed
to be only modified through an external refresh when the source
tables have modifications.

If the source tables associated with a materialized view have
column masking or row-filtering Ranger policies, querying the
MV will throw an error. This behavior is consistent with that
of Hive.

Testing
 - Added tests for compute stats, drop stats, show stats and
   simple select query on an MV.
 - Added a simple test for column masking of source table

TODO:
 - The column masking for the source table does not seem to be
   recognized and querying the MV succeeds instead of failing.
   Need to understand why.

Change-Id: If3108996124c6544a97fb0c34b6aff5e324a6cff
---
M fe/src/main/java/org/apache/impala/analysis/Analyzer.java
M fe/src/main/java/org/apache/impala/analysis/InsertStmt.java
M fe/src/main/java/org/apache/impala/analysis/StmtMetadataLoader.java
A fe/src/main/java/org/apache/impala/catalog/MaterializedViewHdfsTable.java
M fe/src/main/java/org/apache/impala/catalog/Table.java
M fe/src/main/java/org/apache/impala/service/Frontend.java
M fe/src/test/java/org/apache/impala/authorization/AuthorizationStmtTest.java
M testdata/workloads/functional-planner/queries/PlannerTest/views.test
M testdata/workloads/functional-query/queries/QueryTest/compute-stats.test
9 files changed, 205 insertions(+), 3 deletions(-)



  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/95/17595/1
--
To view, visit http://gerrit.cloudera.org:8080/17595
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: If3108996124c6544a97fb0c34b6aff5e324a6cff
Gerrit-Change-Number: 17595
Gerrit-PatchSet: 1
Gerrit-Owner: Aman Sinha <amsi...@cloudera.com>

Reply via email to