如何把hdfs上的一个结构化数据映射为hive的一张表

  • 文件的路径好像有规律 难道要把结构化数据放置在这个路径下? 不一定 外部表指定文件路径
数据库.表 -------》 /user/hive/warehouse/数据库.db/表名
 
  • 建表的字段顺序和类型一定要和文件一致。
create table t_3(id int ,name string age int ) row  format delimited fields terminated by ','

注意:如果类型不一致,hive会尝试转换,不保证转换成功,如果成功就显示,弱国失败就显示为null

 
  • 分割符不一定需要指定,不知道会使用默认分隔符。
create table t_1(id int ,name string ,age int);
create table t_2(id int ,name string ,age int ) row format delimited fields terminated by ","
 

 



猜你喜欢

转载自www.cnblogs.com/TiePiHeTao/p/3e6f2aa193045563baf0ca33f7fd954c.html
今日推荐