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

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

问题描述

我正在使用 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猪数据中的特殊字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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