在Apache Pig数据中转义特殊字符 [英] Escape special characters in Apache pig data

查看:139
本文介绍了在Apache Pig数据中转义特殊字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Apache Pig处理一些数据.
我的数据集包含一些包含特殊字符的字符串,即(#,{}[]).

I am using Apache Pig to process some data.
My data set has some strings that contain special characters i.e (#,{}[]).

编程猪皮书表示您无法转义这些字符.

This programming pig book says that you can't escape those characters.

那么如何在不删除特殊字符的情况下处理我的数据?

我考虑过更换它们,但想避免这种情况.

I thought about replacing them but would like to avoid that.

谢谢

推荐答案

最简单的方法是

input = LOAD 'inputLocation' USING TextLoader() as unparsedString:chararray;

TextLoader只是将输入的每一行读入字符串,而不管该字符串中包含什么内容.然后,您可以使用自己的解析逻辑.

TextLoader just reads each line of input into a String regardless of what's inside that string. You could then use your own parsing logic.

这篇关于在Apache Pig数据中转义特殊字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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