Hive creates hive table partitions using HDFS directory data

Source: Internet
Author: User

Describe:

Hive Table Pms.cross_sale_path is established with the date as the partition, the HDFs directory/user/pms/workspace/ouyangyewei/testusertrack/job1output/ The data on the Crosssale, written on the $yesterday partition of the table

Table structure:

HIVE-E "Set Mapred.job.queue.name=pms;drop table if exists pms.cross_sale_path;create external table Pms.cross_sale_ Path (track_id string,track_time string,session_id string,gu_id string,end_user_id string,page_category_id bigint, algorithm_id int,is_add_cart int,rcmd_product_id bigint,product_id bigint,category_id bigint,path_id string,path_ Type int,path_length int,path_list String,order_code string) partitioned by (DS string) ROW FORMAT delimited fields Termina TED by ' \ t ' LINES TERMINATED by ' \ n ' STORED as textfile;

Writing:

Yesterday= ' date-d -1days +%y-%m-%d ' hive-e ' Load data inpath '/user/pms/workspace/ouyangyewei/testusertrack/ Job1output/crosssale ' into table Pms.cross_sale_path partition (ds= ' $yesterday '); "

Hive creates hive table partitions using HDFS directory data

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.