在把hdfs上数据迁移到hive中的表时,若出现数据位NULL,是因为没有指定列分隔符。

由于hive默认的分隔符是/u0001(Ctrl+A),为了平滑迁移,需要在创建表格时指定数据的分割符号,语法如下:

  1. hive (default)> create external table et (time BIGINT, userid string, content string, urlrank int, urlnum int, url string)
  2. > partitioned by (filenum int)
  3. > row format delimited fields terminated by '\t';

上面创建的是外部表,“导入”数据时可以用load,但若不想进行移动数据,就用命令alter来进行指向:

  1. alter table et add partition (filenum=1) location '/input/SogouQueryLog/file1';

注意location后面跟的地址必须是个目录,若不是,可以用hdfs fs -mv src dest 进行移动数据:

  1. hadoop fs -mv /input/SogouQueryLog/querylog_1 /input/SogouQueryLog/file1

最新文章

  1. bzoj 1711 [Usaco2007 Open]Dining吃饭&&poj 3281 Dining
  2. Array数组标准库
  3. 百度地图API 海量点 自定义添加信息
  4. 【编程题目】设计包含 min 函数的栈
  5. iOS 发送请求时获取cookie
  6. children和childNodes的区别
  7. NEFU 2016省赛演练一 B题(递推)
  8. Ehcache(2.9.x) - API Developer Guide, Cache Manager Event Listeners
  9. python隐含的特性
  10. Catenyms
  11. 使用 Oracle Sql plus的一点经验
  12. iOS中运用正则表达式
  13. 依据二度人脉推荐好友sql
  14. OpenStack - liberty CentOS 7
  15. UE4中如何使物体始终朝向摄像头?
  16. BMCP位图图片压缩算法
  17. Python 事件驱动了解
  18. HDU 3046
  19. CDOJ 1294 天行廖的游戏 dp 容斥
  20. 如何发布可用于azure的镜像文件

热门文章

  1. PHP数组及简单函数
  2. [emacs] 使用ggtags浏览代码
  3. Switch to strategy
  4. Xamarin.Android再体验之简单的登录Demo
  5. 趣味python编程之经典俄罗斯方块
  6. C#不对称加密
  7. WinServer远程部署系统打包批处理文件
  8. JAVA使用JDBC技术操作SqlServer数据库执行存储过程
  9. 使用NPOI创建Excel
  10. tomcat 7 WARNING: A context path must either be an empty string or start with a '/' and do not end with a '/'. The path [/] does not meet these criteria and has been changed to []