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 /;

猜你喜欢

转载自oracle-api.iteye.com/blog/2372681