创建表student,创建文件student.txt ,文件里面有学生数据行数据之间的列用制表(tab)符分割。
需求:把文件中的数据导入到student表中。

创建student表

创建以格式化行以制表符(tab)分割的字段表
create table student(id int, name string) ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t';

创建student.txt文件并新增数据

touch /opt/datas/student.txt


Hive初级使用Hive初级使用

把文本数据导入到student表中

命令:load data local inpath '/opt/datas/student.txt'into table student ;

Hive初级使用

查看结果

  • select * from student ;

    Hive初级使用
  • select id from student ; 就会运行MapReduce 。说明hive进行了优化

    Hive初级使用

相关文章:

  • 2021-11-19
  • 2021-10-29
  • 2021-07-12
  • 2021-11-04
  • 2021-09-29
  • 2021-07-10
  • 2022-12-23
猜你喜欢
  • 2021-05-27
  • 2021-05-06
  • 2022-12-23
  • 2021-10-15
  • 2021-12-07
  • 2021-10-21
相关资源
相似解决方案