pig store oracle
REGISTER ojdbc14.jar;REGISTER /usr/lib/pig/piggybank.jar;
REGISTER Cdr.jar;
DEFINE DPI cn.cinfotech.cdr.pig.ToDpi();
raw = LOAD 'hbase://DPI201211281540'
USING org.apache.pig.backend.hadoop.hbase.HBaseStorage(
'cf1:content', '-loadKey true')
AS (id:chararray, value:bytearray);
logs = FOREACH raw GENERATE flatten(DPI(value));
agreement = FOREACH logs GENERATE (up_traffic+down_traffic) AS flow,protocol,(end_time-start_time) AS times,msisdn;
agreement = FILTER agreement BY (protocol is not null) AND (msisdn is not null);
group_ap = FOREACH (GROUP agreement BY protocol) GENERATE group AS prot, SUM(agreement.flow) AS fl,'201211281540','yyyymmddHH24mi';
group_online = FOREACH (GROUP agreement BY msisdn) GENERATE group AS ms, SUM(agreement.times) AS t,'201211281540','yyyymmddHH24mi';
STORE group_ap INTO 'aaa' USINGorg.apache.pig.piggybank.storage.DBStorage('oracle.jdbc.driver.OracleDriver','jdbc:oracle:thin:@135.251.208.137:1521:orcl','aa','aa','insert into test_ddd values(?,?,to_date(?,?))');
STORE group_online INTO 'bbb' USINGorg.apache.pig.piggybank.storage.DBStorage('oracle.jdbc.driver.OracleDriver','jdbc:oracle:thin:@135.251.208.137:1521:orcl','aa','aa','insert into test_eee values(?,?,to_date(?,?))');
脚本如上,注释掉任意一个STORE都可以写入oracle,为什么两个STORE能执行成功,但写入不了oracle呢?
没人知道吗,自己研究研究DBStorage源码了
页:
[1]