我有一个记录,在蒙哥如下。
{ "_id" : ObjectId("..."), "gender":"male", "age" : 19, "cars" : ["a", "b", "c"], "first" : "Daniel", "last" : "Alabi" }
{ "_id" : ObjectId("..."), "gender":"male", "age" : 21, "cars" : ["d", "e"], "first" : "Tolu", "last" : "Alabi" }
{ "_id" : ObjectId("..."), "gender":"female", "age" : 50, "cars" : [], "first" : "Tinuke", "last" : "Dada" }
我想要的模式是'f:chararray,l:chararray,g:chararray,age:int,汽车:{t:(car:chararray)}'将数据加载到清管器后。
我试过用
TEMP = LOAD 'mongodb://localhost:27017/local.temp' USING com.mongodb.hadoop.pig.MongoLoader('first:chararray, last:chararray, age:int, gender:chararray, cars:{(chararray)}');
DESCRIBE TEMP;
我的输出是
(Daniel,Alabi,19,male,)
(Tolu,Alabi,21,male,)
(Tinuke,Dada,50,female,{})
TEMP: {first: chararray,last: chararray,age: int,gender: chararray,cars: {(val_0: chararray)}}
有人能帮我写一下装货单吗?
1条答案
按热度按时间wsewodh21#
看看这里:
将mongo数组转化为pig元组。