欢迎投稿

今日深度:

hive数据导入,

hive数据导入,


  由于很多数据在hadoop平台,当从hadoop平台的数据迁移到hive目录下时,由于hive默认的分隔符是/u0001,为了平滑迁移,需要在创建表格时指定数据的分割符号,语法如下:

  create table test(uid string,name string)row format delimited fields terminated by '/t';

通过这种方式,完成分隔符的指定。

然后通过hadoop fs -cp或者hadoop distcp 进行文件夹复制。

   由于数据复制的成本比较高,时间比较慢,当不需要复制数据的时候,可以直接采取移动的方式将hadoop数据转移到hive,hadoop  fs -mv src dest。

    一个比较简单的方法是直接创建 external table,语法如下:

create table test(uid string,name string)row format delimited fields terminated by '/t' location 'hdfs';

通过这种方式,避免数据的移动带来时间损耗,提高运行的效率。

www.htsjk.Com true http://www.htsjk.com/hive/41339.html NewsArticle hive数据导入,   由于很多数据在hadoop平台,当从hadoop平台的数据迁移到hive目录下时,由于hive默认的分隔符是/u0001,为了平滑迁移,需要在创建表格时指定数据的分割符号,语法如下:...
相关文章
    暂无相关文章
评论暂时关闭