pig的嵌套json未给出正确的输出
我想使用pig的嵌套json未给出正确的输出,json,hadoop,apache-pig,Json,Hadoop,Apache Pig,我想使用pig对这个json进行query和字段名和值。所以我写了以下脚本: {"query":"32 gb memory card and pen drive","queryObj":{"32 Gb memory card and Pen drive":34359738368,"32 gb memory card and pen drive":6872838602707},"implicitIntent":[],"textualIntent":[{"attributes":{"attribut
pig
对这个json
进行query
和字段名
和值
。所以我写了以下脚本:
{"query":"32 gb memory card and pen drive","queryObj":{"32 Gb memory card and Pen drive":34359738368,"32 gb memory card and pen drive":6872838602707},"implicitIntent":[],"textualIntent":[{"attributes":{"attributes":[{"field":{"name":"store"},"value":"Memory Cards & Readers","properties":{"storeId":"zzf","storePath":"tyy/4mr/zzf","isLeaf":false}} ]}}]}
但这只提供查询输出,而不提供其他两个字段:
G = LOAD 'quattr.json' USING JsonLoader('query:chararray, textualIntent: {(attributes:(attributes:{(field: (name:chararray),value:chararray)}))}') ;
谁能帮我解决这个问题吗?感谢提供给JsonLoader的架构必须以与数据中相同的顺序匹配所有字段。@franklinsijo如果不需要最后的字段,我们可以按顺序提供第一个起始必填字段。不,JsonLoader不可能。对于这种情况,您可以尝试@franklinsijo,谢谢。使用象鸟面临的问题。
(32 gb memory card and pen drive,)