Hadoop Pig:URLDecoder:转义(%)模式中的非法十六进制字符

时间:2016-07-09 23:59:26

标签: hadoop apache-pig

我正在使用pig来解码clicksteam事件,并在遇到字符串'(%)'时遇到错误。

以下是我在以下STORE语句后发生的错误消息:

Caused by: java.lang.IllegalArgumentException: URLDecoder: Illegal hex characters in escape (%) pattern - For input string: "u2"
at java.net.URLDecoder.decode(URLDecoder.java:192)

这是我的代码:

DEFINE UrlDecode InvokeForString('java.net.URLDecoder.decode', 'String String'); 

decoded_strings = FOREACH c GENERATE session_id, event_id
,LOWER(term) as search_term
,UrlDecode(facets, 'UTF-8') as encoded:chararray
,day;

STORE decoded_strings INTO 'database.table' using org.apache.hive.hcatalog.pig.HCatStorer();

1 个答案:

答案 0 :(得分:0)

我在运行UrlDecode之前解决了这个问题,我使用了下面的代码:

REPLACE(facets, 'u2', '') as facets