简体   繁体   English

使用带有回车符的HIVE-Error在Hadoop中加载电子邮件数据

[英]Loading Email data in Hadoop using HIVE-Error with Carriage return

I am trying to load text data in hadoop. 我正在尝试在hadoop中加载文本数据。 Following are the detail 以下是细节

File: 文件:

"Availing Comp-off on 30th April 2014 and 2nd May 2014.eml" “于2014年4月30日和2014年5月2日生效。eml”

Date: Tue, 29 Apr 2014 18:09:20 +0530 (IST)| 日期:2014年4月29日,星期二18:09:20 +0530(IST)|

From: Rahul Tandel/AHD/TCS 来自:Rahul Tandel / AHD / TCS

To: pravita tolanavar | 至:pravita tolanavar |

Cc: upendra.bhandari@uno1.com| 抄送:upendra.bhandari@uno1.com |

Subject: Availing Comp-off on 30th April 2014 and 2nd May 2014| 主题:2014年4月30日和2014年5月2日起生效

Dear Pravita, I am availing comp-off on Wednesday(30th April 2014) and Friday(2nd May 2014) as i was working on weekend - Saturday(13th April 2014-2nd Shift) and Saturday(19th April 2014-1st Shift). 尊敬的Pravita,我在周末(周六(2014年4月13日至第二班)和周六(2014年4月19日至第一班))工作时,将分别于2014年4月30日(星期三)和星期五(2014年5月2日)进行休假。 I have informed Kamlesh regarding the same. 我已经通知Kamlesh了。

Thanks & Regards Rahul Tandel PS PAG PGA Mailto: rahul.tandel@uno1.com Website: http://www.uno1.com 致谢Rahul Tandel PS PAG PGA邮件:rahul.tandel@uno1.com网站: http : //www.uno1.com

HIVE Table schema: HIVE表架构:

" create table mail (mail_data STRUCT<DATE_M:STRING, FROM_m:STRING, TO_m:STRING,   CC_M:STRING, SUBJECT_m:STRING, DATA_M:STRING>) ROW FORMAT DELIMITED FIELDS TERMINATED BY '\001' COLLECTION ITEMS TERMINATED BY '\174' LINES TERMINATED BY '\n';"

THe table is created sucessfully. 表已成功创建。 But when I load data, I see the 19 rows instead of single row. 但是,当我加载数据时,我看到的是19行而不是单行。 I tried to find the reason, it seems hive does not have a mechanism to detect newline and break the input file. 我试图找到原因,似乎蜂巢没有检测换行和中断输入文件的机制。

If anyone has a better solution, please help 如果有人有更好的解决方案,请帮助

enter code here 在这里输入代码

Regards Upendra 问候Upendra

I have the exact same situation and all I have managed to do is to replace new lines and tabulations with regexp_replace function : 我有完全相同的情况,我所要做的就是用regexp_replace函数替换新行和列表:

regexp_replace(TEXT_HERE, '\\t|\\r|\\n', ' ')

If anyone has a better solution I would appreciate ! 如果有人有更好的解决方案,我将不胜感激!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM