加入 - 猪脚本

时间:2017-10-04 04:23:00

标签: hadoop hdfs apache-pig hadoop-partitioning

我是Pig脚本的新手。我需要帮助加入' B'和' E'。下面是我的脚本。

    A = LOAD ....
    PAPS_1 = FILTER A BY (dataMap#'corr_id_' is NOT null);
    B = FOREACH PAPS_1 GENERATE dataMap#'corr_id_' as id, dataMap#'response' as resp, status;
    C = LOAD ..
    D = FILTER C BY (dataMap#'corr_id_' is NOT null);
    E = FOREACH D GENERATE dataMap#'corr_id_' as id, status;

我尝试过像这样加入。但它不起作用。我得到空值。请指正。

F = JOIN B BY id, E BY id;

B中的值:

23456ac,200,0

3453da3,200,0

C中的值:

23456ac,0

3453da3,0

E中的值:

23456ac,0

3453da3,0

我的输出是:

NULL,200,0,NULL,0

NULL,200,0,NULL,0

预计

23456ac,200,0,23456ac,0

3453da3,200,0,3453da3,0

提前致谢

0 个答案:

没有答案