问题
Select x,y,..,
CASE(
when A.A_code = 'G' THEN
COUNT(DISTINCT CASE
WHEN T.trxn = 'P' THEN
D.A || D.B || D.C
ELSE
NULL
END)
else
0
end p_count,..From..
is my plsql query structure. I need to convert it.
I have converted the inner case query success fully and it is executed,
the inner query of the plsql case condition will become in PIG as
T = LOAD '//transaction_types' USING PigStorage(',') as (id:int,trxn:chararray);
D = LOAD '/home/sterlingpc1/Desktop/det_trades' USING PigStorage(',') as (id:int,A:chararray,B:chararray,C:chararray);
JOINED = JOIN T by id,D by id;
p_count = FOREACH JOINED GENERATE
(case T::trxn
WHEN 'P'
THEN
CONCAT(D::A,D::B,D::C)
ELSE
NULL
END)
Before that i need to check the outer condition(A.A_code = 'G'). It looks like while condition . But the table field which we need to check is different.They are from different tables Please guide me how to check the A.A_code = 'G' first. Then only the inner query will be executed.
Please give me a solution as soon as possible. Thanks in advance!
来源:https://stackoverflow.com/questions/30860944/plsql-to-pig-conversion