导入数据到hive外部表;
1.hive命令创建外部表。
create EXTERNAL table applogsnew
(
applogid string,
msgtype string,
clienttype string,
userid bigint
)
PARTITIONED BY (create_time string)
row format delimited
fields terminated by '\t'
stored as textfile
location '/data/sda/apache-hive-1.2.1-bin/tmp/warehouse/applogsnew';
2.通过hadoop命令创建目录,上传文件到对应的目录。
hadoop fs -mkdir /data/sda/apache-hive-1.2.1-bin/tmp/warehouse/applogsnew/create_time=20160531
hadoop fs -put /home/appadmin/web/000000_0 /data/sda/apache-hive-1.2.1-bin/tmp/warehouse/applogsnew/create_time=20160531/

3.通过hive命令关联数据到分区
alter table applogsnew add partition (create_time='20160531') location '/data/sda/apache-hive-1.2.1-bin/tmp/warehouse/applogsnew/create_time=20160531';

相关文章:

  • 2022-01-09
  • 2021-07-21
  • 2022-12-23
  • 2022-12-23
  • 2021-09-14
  • 2022-01-30
  • 2021-07-16
猜你喜欢
  • 2022-12-23
  • 2021-10-18
  • 2021-09-19
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-16
相关资源
相似解决方案