Hive Shell Common Commands

Source: Internet
Author: User

Hive command Line Common commands

Loading data

Load data local inpath '/home/ivr_csr_menu_map.txt ' into table ivr_csr_menu_map;

Partitioned by:

Load data local inpath '/home/lftest/lf1.txt ' overwrite into table lf_test partition (dt=20150927);

Add overwrite will overwrite the original data (if any) if not added, and the original data, a copy file will be generated

Load data local inpath '/home/lftest/lf1.txt ' overwrite into table lf_test partition (dt=20150927);

DFS can be used within the Hive command line to perform some Hadoop commands

View Catalog

Dfs-ls/apps/hive/warehouse/lf_test;

View File Contents

Hive> Dfs-text/apps/hive/warehouse/lf_test/dt=20150928/lf.txt;

deleting files

Dfs-rm/apps/hive/warehouse/lf_test/dt=20150927/lf1_copy_2.txt;

Delete Directory

Dfs-rm-r/apps/hive/warehouse/lf_test;

Show Table Partitioning

Show Partitions lf_test;

adding partitions

ALTER TABLE Lf_test add partition (dt=20150928);

Delete Partition

ALTER TABLE Lf_test drop partition (dt=20150928);

Show detailed table structure: (includes information such as fields, partitions, etc.)

Desc formatted ivr_calldata;

Display the Build Table statement

Show CREATE TABLE sas_ambs;

To delete a table:

drop table lf_test;

Renaming a table

ALTER TABLE employee RENAME to EMP;

CREATE TABLE (internal table):

Hive> CREATE TABLE lf_test (ID int,name string,age Int,tel string)

> Partitioned by (DT string)

> ROW FORMAT Delimited

> TERMINATED by ' | '

> STORED as Textfile;

External table

Create EXTERNAL Table Ivr_csr_menu_map (

csr_reason_id String,

Csr_reason_name String,

ivr_node_id String,

Ivr_node_name string)

ROW FORMAT Delimited

Fields TERMINATED by ' | '

STORED as Textfile

Location '/spdbccc/data/dest/ivr/ivr_csr_menu_map/'; Specifies the path to the data file, at which time the folder is not generated under warehouse

Hive Shell Common Commands

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.