hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Hadoop Wiki] Update of "Hive/PartitionedViews" by JohnSichi
Date Tue, 01 Feb 2011 20:48:50 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Hadoop Wiki" for change notification.

The "Hive/PartitionedViews" page has been changed by JohnSichi.
http://wiki.apache.org/hadoop/Hive/PartitionedViews?action=diff&rev1=2&rev2=3

--------------------------------------------------

   1. One possible approach mentioned in [[https://issues.apache.org/jira/browse/HIVE-1079|HIVE-1079]]
is to infer view partitions automatically based on the partitions of the underlying tables.
 A command such as SHOW PARTITIONS could then synthesize virtual partition descriptors on
the fly.  This is fairly easy to do for use case #1, but potentially very difficult for use
cases #2 and #3.  So for now, we are punting on this approach.
   1. Instead, we will require users to explicitly declare view partitioning as part of CREATE
VIEW, and explicitly manage partition metadata via ALTER VIEW {ADD|DROP} PARTITION.  This
allows all of the use cases to be satisfied (while placing more burden on the user, and taking
up more metastore space).
  
+ = Syntax =
+ 
+ {{{
+ CREATE VIEW [IF NOT EXISTS] view_name [ (column_name [COMMENT column_comment], ...) ]
+ [COMMENT table_comment]
+ [ PARTITIONED ON (col1, col2, ...) ]
+ [ TBLPROPERTIES ... ]
+ AS SELECT ...
+ 
+ ALTER VIEW view_name ADD [IF NOT EXISTS] partition_spec partition_spec ...
+ 
+ ALTER VIEW view_name DROP [IF EXISTS] partition_spec, partition_spec, ...
+ 
+ partition_spec:
+   : PARTITION (partition_col = partition_col_value, partition_col = partiton_col_value,
...)
+ }}}
+ 
+ Notes:
+ 
+  * Whereas CREATE TABLE uses PARTITIONED BY, CREATE VIEW uses PARTITIONED ON.  This difference
is intentional because in CREATE TABLE, the PARTITIONED BY clause specifies additional column
definitions which are appended to the non-partitioning columns.  With CREATE VIEW, the PARTITIONED
ON clause references (by name) columns already produced by the view definition.  Only column
names appear in PARTITIONED ON; no types etc.  However, to match the CREATE TABLE convention
of trailing partitioning columns, the columns referenced by the PARTITIONED ON clause must
be the last columns in the view definition, and their order in the PARTITIONED ON clause must
match their order in the view definition.
+  * The ALTER VIEW ADD/DROP partition syntax is identical to ALTER TABLE, except that it
is illegal to specify a LOCATION clause.
+  * Other ALTER TABLE commands which operate on partitions (e.g. TOUCH/ARCHIVE) are not supported.
 (But maybe we need to support TOUCH?)
+ 

Mime
View raw message