Hive view of how to create, features and application scenarios

Hive View Features

  1. View logic is present, Hive not support materialized views (1.0.3)
  2. View read-only, does not support the LOAD / INSERT / ALTER. View the definition needs to be changed, either by Alter View
  3. It may contain ORDER BY / LIMIT statements within the View, if a query against the view also contains these statements, in view of the statement higher priority. For example, data defining the view limit 10, 20 for the query view limit, a maximum of 10 data returns.
  4. Hive support iteration view.

Query 5.Hive in view of the common queries and similar query table name can be replaced with a view name.

Hive view creation

  • View and as a view table, you can specify Database;
  • Create a view
CREATE VIEW [IF NOT EXISTS] view_name [(column_name [COMMENT column_comment], ...) ] [COMMENT view_comment] [TBLPROPERTIES (property_name = property_value, ...)] AS SELECT ... 
  • Delete View
DROP VIEW [IF EXISTS] view_name 
  • Modify View
ALTER VIEW view_name SET TBLPROPERTIES table_properties  
table_properties:  
  : (property_name = property_value, property_name = property_value, ...) 

Hive view scenarios

  • View mode can be used to ensure the consistency of data warehouse dimensions dimensions dimensions and sub-dimensions of role-playing;
  • When Hive query becomes long or complex, by dividing this query view into a plurality of smaller, more manageable fragments may reduce this complexity;
  • Hive need to limit the view through the filtered data based on the condition;

Guess you like

Origin www.cnblogs.com/sx66/p/12039521.html