使用 Hadoop Pig 从文本文件中加载数据,每条记录位于多行? [英] Use Hadoop Pig to load data from text file w/ each record on multiple lines?

查看:23
本文介绍了使用 Hadoop Pig 从文本文件中加载数据,每条记录位于多行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的数据文件格式如下:

I have my data file in the following format:

U:    john
T:    2011-03-03 12:12:12
L:    san diego, CA

U:    john
T:    2011-03-03 12:12:12
L:    san diego, CA

使用 Hadoop/pig/任何内容读取此文件以进行分析的最佳方法是什么?

What's the best way to read this file w/ Hadoop/pig/whatever for analysis?

推荐答案

有什么方法可以控制写入数据的方式吗?编写一个将其移至制表符分隔的流程将有助于您开箱即用.

Is there any way you can control the way the data is being written? Writing an process that moves this to tab separated would help you do this out of the box.

否则,编写自定义记录阅读器(在 Pig 或 Java MapReduce 中)可能是您唯一的选择.两者都不难.

Otherwise, writing a custom record reader (in Pig or Java MapReduce) might be your only option. Neither is very hard.

这篇关于使用 Hadoop Pig 从文本文件中加载数据,每条记录位于多行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆