将xlsx文件加载到Pig中 [英] Load xlsx file into Pig

查看:78
本文介绍了将xlsx文件加载到Pig中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么方法可以将.xlsx文件加载到Pig中吗?我需要使用excel文件[.xlsx]作为输入在PIG中执行操作,但是我找不到用于此目的的任何内置函数.

任何帮助实现这一目标的方法都是很有意义的.

谢谢

解决方案

尝试一下,

首先将xlsx文件转换为csv,然后执行以下操作,

REGISTER Location\to\piggybank.jar

Data = load 'Location\to\csv\file' using org.apache.pig.piggybank.storage.CSVExcelStorage(',', 'NO_MULTILINE', 'NOCHANGE', 'SKIP_INPUT_HEADER') as (col1,col2,..);

它(CSVExcelStorage)为我工作.希望它能起作用.

Is there any way to load .xlsx files into Pig? I need to perform an operation in PIG using the excel file [.xlsx] as input, but i couldn't find any built-in functions available for this purpose.?

Any help to achieve this would be appreciable.

Thanks,

解决方案

Try this,

First convert the xlsx file into csv then do the following,

REGISTER Location\to\piggybank.jar

Data = load 'Location\to\csv\file' using org.apache.pig.piggybank.storage.CSVExcelStorage(',', 'NO_MULTILINE', 'NOCHANGE', 'SKIP_INPUT_HEADER') as (col1,col2,..);

It (CSVExcelStorage) worked for me. Hope it works.

这篇关于将xlsx文件加载到Pig中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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