欢迎投稿

今日深度:

Hive基本操作,

Hive基本操作,


1. create table 

hive> CREATE TABLE IF NOT EXISTS employee ( eid int, name String,
salary String, destination String)
COMMENT ‘Employee details’
ROW FORMAT DELIMITED
FIELDS TERMINATED BY ‘\t’
LINES TERMINATED BY ‘\n’
STORED AS TEXTFILE;

 
2. insert record

hive> insert into employee (eid,name) values(12,'peter');

 

3. load file to hive

1201	Gopal	45000	Technicalmanager
1202	Manisha	45000	Proofreader
1203	Masthanvali40000	Technicalwriter
1204	Kiran	40000	HrAdmin
1205	Kranthi	30000	OpAdmin

hive> load data local inpath '/root/employee' into table employee ;

 
4. check file in hadoop:

hadoop fs -ls -R  /user/hive/warehouse

 

hive 中执行shell命令:

hive>!clear;

hive 中执行dfs命令:

hive>dfs -ls -R /;

www.htsjk.Com true http://www.htsjk.com/hive/40613.html NewsArticle Hive基本操作, 1. create table  hive CREATE TABLE IF NOT EXISTS employee ( eid int, name String,salary String, destination String)COMMENT ‘Employee details’ROW FORMAT DELIMITEDFIELDS TERMINATED BY ‘\t’LINES TERMINATED BY ‘\n’...
相关文章
    暂无相关文章
评论暂时关闭