HIVE create partition

Source: Internet
Author: User

HIVE partition by enabling the Partitionby implementation when the table is created, the dimension used to partition is not a column of the actual data, and the partition-specific flag is given when the content is inserted. When you want to query the contents of a partition, you can use the where statement, which resembles where Tablename.partition_key >a to implement. Create a table with partitions. Command prototypes:CREATE TABLE Page_view (viewtime INT, UserID BIGINT, page_urlstring, referrer_url STRING, ip stringcomment ' IP Addr ESS of the User ') COMMENT ' This isthe Page view table ' partitioned by (dtstring, Country STRING) Clusteredby (userid) SORTED by (Viewtime) into + bucketsrow formatdelimited fieldsterminated by ' \001 ' COLLECTION itemsterminated by ' \002 ' MAP keysterminate D by ' \003 ' STORED assequencefile;
Eg:Build Table:CREATE TABLE c02_clickstat_fatdt1(YYYYMMDD string,ID INT,IP String,Country String,cookie_id String,page_id String,clickstat_url_id int,query_string String,Refer string) partitioned by (DT STRING)row format delimited fields terminated by ' \005 ' stored astextfile;Loading Data:LOAD DATA inpath '/user/admin/sqlldrdat/cnclickstat/20101101/19/clickstat_gp_fatdt0/0 ' Overwriteinto TABLE c02_ CLICKSTAT_FATDT1PARTITION (dt= ' 20101101 ');Access a partitionSELECT Count (*)FROMC02_CLICKSTAT_FATDT1 aWHERE a.dt >= ' 20101101 ' and A.dt < ' 20101102 ';

HIVE create partition

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.