直接上代码,如下List-1,会将student_info的数据导入到/tmp/student_info文件中
List-1
bin/hive -e "select * from default.student_info ;" > /tmp/student_info
将宿主机上文件的内容导入到Hive表中,如下List-2
List-2
hive> load data local inpath '/tmp/sutdent_info' into table test.student_info;
Loading data to table table test.student_info
OK
Time taken: 1.57 seconds
注意,俩个表的建表语句要一样.