这是我的剧本:
Customer = LOAD '/home/hduser/PigSandbox/PigOut/Customer_Base.json/part-r-00000' USING JsonLoader();
CustomerPost = FOREACH Customer GENERATE ((chararray)Email
,DateModified
,Age
,City
,Name
,Occupation
,State
,Address1
,Address2
,Company
,Country
,DateOfBirth
,Fax
,Phone
,PostalCode);
DUMP CustomerPost;
这是我得到的错误:
java.lang.Exception: org.apache.pig.backend.executionengine.ExecException: ERROR 1075: Received a bytearray from the UDF or Union from two different Loaders. Cannot determine how to convert the bytearray to string.
我想要做的就是将电子邮件从bytearray
投射到chararray
。如果有更好的方法来做这个而不是生成一个新的包请告诉我。如果不是,我怎么能得到我的工作?或者至少这个错误是什么意思?
我的猪版本从2014年11月16日起为0.14.0
以下是一个示例行:
{"Email" : "foo@bar.com", "DateModified":"2014-12-27T07:36:38.000-05:00","Age":"10-20","City":"Some Location","Name":"foo","Occupation":"engineer","State":"ok","Address1":"foo lane","Address2":null,"Company":"lorem","Country":"us","DateOfBirth":"1969","Fax":"555-555-5555","Phone":"555-555-5555","PostalCode":"12345"}
这是模式文件
{"fields":[{"name":"Email","type":50,"description":"autogenerated from Pig Field Schema","schema":null},{"name":"DateModified","type":30,"description":"autogenerated from Pig Field Schema","schema":null},{"name":"Age","type":55,"description":"autogenerated from Pig Field Schema","schema":null},{"name":"City","type":55,"description":"autogenerated from Pig Field Schema","schema":null},{"name":"Name","type":55,"description":"autogenerated from Pig Field Schema","schema":null},{"name":"Occupation","type":55,"description":"autogenerated from Pig Field Schema","schema":null},{"name":"State","type":55,"description":"autogenerated from Pig Field Schema","schema":null},{"name":"Address1","type":55,"description":"autogenerated from Pig Field Schema","schema":null},{"name":"Address2","type":55,"description":"autogenerated from Pig Field Schema","schema":null},{"name":"Company","type":55,"description":"autogenerated from Pig Field Schema","schema":null},{"name":"Country","type":55,"description":"autogenerated from Pig Field Schema","schema":null},{"name":"DateOfBirth","type":55,"description":"autogenerated from Pig Field Schema","schema":null},{"name":"Fax","type":55,"description":"autogenerated from Pig Field Schema","schema":null},{"name":"Phone","type":55,"description":"autogenerated from Pig Field Schema","schema":null},{"name":"PostalCode","type":55,"description":"autogenerated from Pig Field Schema","schema":null}}