Dictionary 使用pig以不同的方式读取json
我的json文件Dictionary 使用pig以不同的方式读取json,dictionary,schema,tuples,apache-pig,Dictionary,Schema,Tuples,Apache Pig,我的json文件 STOCK_A = LOAD 'file.json' USING JsonLoader('messages:{(food:chararray, person:chararray, amount:int)}'); rowarr = FOREACH STOCK_A GENERATE FLATTEN(messages.(food, person,amount)); 我的代码 STOCK_A = LOAD 'file.json' USING JsonLoader('message
STOCK_A = LOAD 'file.json'
USING JsonLoader('messages:{(food:chararray, person:chararray, amount:int)}');
rowarr = FOREACH STOCK_A GENERATE FLATTEN(messages.(food, person,amount));
我的代码
STOCK_A = LOAD 'file.json'
USING JsonLoader('messages:{(food:chararray, person:chararray, amount:int)}');
rowarr = FOREACH STOCK_A GENERATE FLATTEN(messages.(food, person,amount));
结果模式
rowarr: {null::food: chararray,null::person: chararray,null::amount: int}
预期的
rowarr: {food: chararray,person: chararray,amount: int}
我怎样才能做到这一点?有什么想法吗。。。生成空::食物作为食物等。。。或者直接
FOREACH STOCK\u A生成扁平化(messages.(食物、人、数量))为(食物、人、数量)代码>成功了..谢谢Balduz