1
child = load 'file_name' using PigStorage('\t') as (child_code : chararray, child_id : int, child_precode_id : int);
parents = load 'file_name' using PigStorage('\t') as (child_id : int, child_internal_id : chararray, mother_id : int, father_id : int);
joined = JOIN child by child_id, parents by child_id;
mainparent = FOREACH joined GENERATE child_id as child_id_source, child_precode_id, child_code;
store parent into '(location of file)' using PigStorage('\t');
childfirst = JOIN mainparent by (child_id_source), parents by (mother_id OR father_id);
firstgen = FOREACH childfirst GENERATE child_id, child_precode_id, child_code;
store firstgen into 'file_location' using PigStorage('\t');
得到以下錯誤,當我使用OR條件: - :解析過程中的錯誤 豬加入使用或有條件的運營商拋出錯誤
ERROR org.apache.pig.PigServer異常分析過程中。豬腳本無法解析: NoViableAltException(91 @ [])解析失敗:豬腳本未能 解析:NoViableAltException(91 @ [])
這工作,它也解決了獲取重複的問題,謝謝 – Venkat