Apache pig 将字段值与pig中袋子中的值匹配

Apache pig 将字段值与pig中袋子中的值匹配,apache-pig,Apache Pig,我与pig有以下格式的关系: test=file::field1:chararray,x::y:{(z:chararray)} 例如:测试=a,({(a)、(b)、(c)、(d)}) 我想检查行李x中是否存在field1值(即a)。如何在pig中实现这一点?我发现在pig中没有实现这一点的方法。我已将字段和包传递给python UDF,并在那里进行匹配,如下所示: @outputSchema('matchindx:int') def pythudf(field1,bag): for wor

我与pig有以下格式的关系:

test=file::field1:chararray,x::y:{(z:chararray)}

例如:测试=a,({(a)、(b)、(c)、(d)})


我想检查行李x中是否存在field1值(即a)。如何在pig中实现这一点?

我发现在pig中没有实现这一点的方法。我已将字段和包传递给python UDF,并在那里进行匹配,如下所示:

@outputSchema('matchindx:int')
def pythudf(field1,bag):
   for word in bag:
        if (word[0] == field1):
                return 1             
   return 0