美文网首页
txt导入到hive

txt导入到hive

作者: cure_py | 来源:发表于2018-12-05 16:51 被阅读0次
  1. 在自己电脑上excel里录入内容


  2. 复制去txt
    在notepad++ 里查看一下所有符号,保持一致。有时候 --> 会变成 .....


  3. 上传至linux 自己账号下,俗称本地。没有上传就 vim a.txt这种,复制粘贴进去

rz -y
  1. pwd获取 txt的路径
  2. hive中创建表
CREATE TABLE `vip_mid.paypoint_tmp2`(
`plat` string, 
`channel` string, 
`position` string, 
`paypoint` string, 
`refer_name` string)
row format delimited fields terminated by '\t' 
--lines terminated by '\n' 
stored as textfile;
  1. load进hive
load data local inpath '/home/zhangzhiyu/cure/a.txt' overwrite into table vip_mid.paypoint_tmp2;

语句中要有 stored as textfile 否则会报下面的错误
报错:
Failed with exception Wrong file format. Please check the file's format.
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.MoveTask

  1. 插入最终的表
insert into vip_mid.paypoint_tmp select * from vip_mid.paypoint_tmp2;

相关文章

  • txt导入到hive

    在自己电脑上excel里录入内容 复制去txt在notepad++ 里查看一下所有符号,保持一致。有时候 --> ...

  • Hive导入文件案例

    1需求 ​ 将本地/opt/module/datas/student.txt 这个目录下的数据导入到 hive...

  • Sqoop数据迁移

    从RDB导入到HDFS 从RDB导入到Hive 注:往hive导入数据之前需要创建好database--delet...

  • hive 笔记

    参考 docker compose 操作命令 如何把 hdfs 数据导入到 Hive

  • sqoop数据导出导入命令

    1. 将mysql中的数据导入到hive中 sqoop import --connect jdbc:mysql:/...

  • hive-函数-计算单词出现次数

    数据: hive-wc.txt hello,world,welcomehello,welcome 创建表: cr...

  • 项目切换环境时,pip一键导出与安装

    把一个环境中的所有pip的包全部导入到mypackages.txt 从mypackages.txt中导出所有包到另...

  • 使用hive进行日志分析

    任务 将一批登陆日志导入到hive中,然后通过hive计算如下数据,并将计算结果存入mongoDB。1、每小时的登...

  • Hive知识汇总

    两种Hive表 hive存储:数据+元数据 托管表(内部表) 创建表: 准备数据文件my.txt 灌数据: 查看数...

  • 2016笔记——读取本地文件

    今天接触了读取本地txt文件。 下面就是我的测试内容: 1、我新建了一个txt文本 2、将文件导入到项目中 3、种...

网友评论

      本文标题:txt导入到hive

      本文链接:https://www.haomeiwen.com/subject/kbswcqtx.html