我試着從HCatalog加載表,做一些數據練習並將其存儲到另一個表中。類型轉換的問題 - 豬 - > HC目錄
源表:stage.iboa_event_definitions
inno_description string
inno_id double
inno_name string
inno_url string
inno_valid_from string
inno_valid_to string
目標表:
create table dictionary (id int,src_id double,source_code string, src_code string, src_description string, group_code string);
我的腳本:
iboa_event_definitions = LOAD 'stage.iboa_event_definitions' USING org.apache.hcatalog.pig.HCatLoader();
iboa_event_definitions_filter = foreach iboa_event_definitions generate inno_id as src_id, 'IBOA' as source_code, inno_name as src_code, inno_description as src_description, '' as group_code;
iboa_event_definitions_filter_id = RANK iboa_event_definitions_filter;
final_table = foreach iboa_event_definitions_filter_id generate rank_iboa_event_definitions_filter as id:int, src_id, source_code as source_code, src_code,
src_description, group_code;
store final_table into 'dictionary' using org.apache.hcatalog.pig.HCatStorer();
我得到錯誤:
2013-11-26 13:18:06,140 [main] INFO org.apache.pig.tools.pigstats.ScriptState - Pig features used in the script: RANK 2013-11-26 13:18:06,143 [main] INFO org.apache.pig.newplan.logical.rules.ColumnPruneVisitor - Columns pruned for iboa_event_definitions: $3, $4, $5 2013-11-26 13:18:06,212 [main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR 1115: Unsupported type: 10 in Pig's schema Details at logfile: /export/home/pig/pig_1385463241554.log
爲什麼? 讓我們來檢查字段類型。
describe iboa_event_definitions_filter_id;
iboa_event_definitions_filter_id: {rank_iboa_event_definitions_filter: long,src_id: double,source_code: chararray,src_code: chararray,src_description: chararray,group_code: chararray}
describe final_table;
final_table: {id: int,src_id: double,source_code: chararray,src_code: chararray,src_description: chararray,group_code: chararray}
也許錯誤是由Long類型引起的?但這就是爲什麼我試圖將其轉換爲int。
任何人都可以幫助我解決這個問題嗎?
感謝
帕維爾
我的建議是嘗試刪除大多數列以找到壞列。您也可以嘗試檢查文檔/源以找到「10」在「不支持的類型:豬的模式中的10」中的含義 – Ruslan
我kwot問題是什麼列 - >由RANK操作創建的列:rank_iboa_event_definitions_filter。 –
更正:kwot - >知道 –