Hadoop - 使用 PIG 加载 Hive 表 [英] Hadoop - Load Hive tables using PIG

查看:50
本文介绍了Hadoop - 使用 PIG 加载 Hive 表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用 Pig 加载 Hive 表.我认为我们可以通过 HCatLoader 做到这一点,但我使用 xml 文件来加载 pig.为此,我必须使用 XMLLoader.我可以使用两个选项在 Pig 中加载 XML 文件吗?

I want to load Hive tables using Pig. I think we can do this through HCatLoader but I am using xml files to load pig. For this, I have to use XMLLoader. Can I use two options to load XML files in Pig.

我正在使用我自己的 UDF 从 XML 文件中提取数据,一旦我们提取了所有数据,我必须将 Pig 数据加载到 Hive 表中.

I am extracting data from XML files using my own UDF and once we extract all the data, I have to load Pig data in Hive tables.

我无法使用 HIVE 提取 XML 数据,因为我收到的 XML 非常复杂,我编写了自己的 UDF 来解析 XML.任何关于如何使用 PIG 数据加载 Hive 表的建议或指示.

I can't use HIVE to extract the XML data as the XML I received is quite complex and I wrote my own UDF to parse the XML. Any suggestions or pointers how we can load Hive tables using PIG data.

我正在使用 AWS.

推荐答案

您可以使用 HCatStorer 将 pig 中的数据存储到 Hive 表中.例如:

You can store data from pig into Hive tables using HCatStorer. For example:

register 's3n://bucket/path/xmlUDF.jar'
xml = LOAD 's3n://bucket/pathtofiles' USING xmlUDF();
STORE xml INTO 'database.table' USING org.apache.hive.hcatalog.pig.HCatStorer();

你的问题不是很清楚.您是否希望在 pig 中处理 XML 和 Hive 数据,做一些事情,然后将结果存储在 Hive 中?只是想将 XML 数据存储在 Hive 中并在那里使用它?

Your question isn't quite clear. Are you hoping to work with the XML and Hive data within pig, do something, and then store the result in Hive? Just trying to store the XML data in Hive and work with it there?

这篇关于Hadoop - 使用 PIG 加载 Hive 表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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