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 /;
本站文章为和通数据库网友分享或者投稿,欢迎任何形式的转载,但请务必注明出处.
同时文章内容如有侵犯了您的权益,请联系QQ:970679559,我们会在尽快处理。