我要做的是在HBASE
PIG
创建嵌套数组
所以基本上我做了以下几点:
//Loading some address data
CITY = LOAD '/user/root/landingzone/ADRPCDCITY.csv' using PigStorage(';')
AS (dPOST_CODE:chararray, dCITY_CODE:chararray);
//Create the BAG by grouping postal code
B = GROUP CITY by dPOST_CODE;
//Store it in HBASE
STORE B INTO 'hbase://TEST_ADDRESS_VALIDATION'
USING org.apache.pig.backend.hadoop.hbase.HBaseStorage(
'f1: group, f1:CITY' );
我遇到的问题是BAG
无法投放到HBASE
地图类
java.lang.ClassCastException: org.apache.pig.data.InternalCachedBag cannot be cast to java.util.Map
非常感谢您的帮助!
答案 0 :(得分:0)
更好 我得到了一个我想分享的解决方案
CITY = LOAD '/user/root/landingzone/CITY_Test.csv' using PigStorage(';')
AS (POST_CODE:chararray, CITY_CODE:long, CITY_NAME:chararray);
A = FILTER CITY BY (POST_CODE) IS NOT NULL;
result = FOREACH A GENERATE POST_CODE, TOMAP(UPPER(CITY_NAME), CITY_CODE);
STORE result INTO 'CITY_ADDRESS_VALIDATION' USING org.apache.pig.backend.hadoop.hbase.HBaseStorage( 'f1' );
使用TOMAP并通过HbaseStorage保存它但不在那里分配地图,就可以了。