Shell creates hive table partition periodically

Source: Internet
Author: User


First look at the help command for hive:

[[email protected] hive]$ hive-hmissing argument for option:husage:hive-d,--define <key=value> Va Riable subsitution to the Apply to hive commands. e.g.-D a=b or--define a=b--database <databasename> Specify the database to Use-e <quoted-query-string&         Gt SQL from command line-f <filename> SQL from files-h,--help Print Help in Formation-h 

To increase table partitioning for hive tables using crontab timing:




Method 1:

-e <quoted-query-string>         SQL from command line


Execute command:

[[email protected] hive]$ hive--database gcld-e ' ALTER TABLE Gcldlog add partition (dt=\\ ' 2015-06-14\\ ') location \ \ ' 2015-06-14\\ ';


Logging initialized using configuration in File:/etc/hive/conf.dist/hive-log4j.properties
Ok
Time taken:1.097 seconds






Method 2:

-I <filename>                    initialization SQL file

Edit the SQL command:

ALTER TABLE Gcldlog Add partition (dt= ' 2015-06-10 ') location ' 2015-06-10 ';

Exit; (Remember to add the Exit command)


Execute command:

Hive--database gcld-i/script/gcld/test.sql;




This enables the shell to dynamically add partitioned tables to the Hive table.









Shell creates hive table partition periodically

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.