Apache pig Apache清管器字符串拆分

Apache pig Apache清管器字符串拆分,apache-pig,Apache Pig,我正在使用Pig STRSPLIT,在处理以前解码的相当复杂的字符串时遇到了问题 这是我的数据(查莱,查莱): 这是我的密码: c3 = FOREACH c2 GENERATE search_term ,STRSPLIT(encoded, '\\^', -1) as facets_array ,day; dump c3; 这是我当前的c3输出: (test_term,(category_facet=SAAS~All Refrigerators~pcmcat367,features_facet=

我正在使用Pig STRSPLIT,在处理以前解码的相当复杂的字符串时遇到了问题

这是我的数据(查莱,查莱):

这是我的密码:

c3 = FOREACH c2 GENERATE search_term
,STRSPLIT(encoded, '\\^', -1) as facets_array
,day;
dump c3;
这是我当前的c3输出:

(test_term,(category_facet=SAAS~All Refrigerators~pcmcat367,features_facet=Features~ENERGY STAR,brand_facet=Brand~GE))
这是我想要的输出:

test_term, category, SAAS~All Products~pcmcat367
test_term, features, ~ENERGY STAR
test_term, brand_facet, Brand~GE

你有一个非常奇怪的序列化数据。你为什么不创建一个udf,在那里你可以干净地应用你的操作。实际上,你必须首先在^处拆分以获得所有的刻面,然后对于每个刻面,在“=”上拆分以获得值,对吗?@debarshi-是的,我刚刚更新了我的代码以在^处进行拆分。现在,我需要将输出更新为所需的输出。为什么不使用“=”将其拆分,然后将其展平。我建议你写一个udf,它会让你的代码更干净,我可以用正则表达式来表达吗@杰克罗特
test_term, category, SAAS~All Products~pcmcat367
test_term, features, ~ENERGY STAR
test_term, brand_facet, Brand~GE