pig hbastorage-如何从数据库中生成动态列名和动态数量的列限定符?

hwazgwia  于 2021-06-03  发布在  Hadoop
关注(0)|答案(0)|浏览(195)

a和b的关系是1:m。

A = LOAD ... AS (
    a_id:char
    ,...
);
B = LOAD ... AS (
    a_id:chararray
    ,b_id:chararray
    ,...
);
JOINED = JOIN A BY a_id, B BY a_id;
GROUPED = GROUP JOINED BY a::a_id;

这将创建具有以下架构的数据包:

{group: chararray, JOINED: {(A:a_id, ..., B::a_id, B::b_id, ...)}}

例如:

(1, {(1, ..., 1, 1, ...)})
(2, {(2, ..., 2, 2, ...), (2, ..., 2,3, ...), (2, ...,2,4, ...)})
(3, {(3, ..., 3, 5, ...)})

对于这三行,相应的hbase结果如下所示:

rowkey = 1, A:a_id=1, ... B:b1|a_id=1, B:b1|b_id:=1
rowkey = 2, A:a_id=2, ... B:b2|a_id=2, B:b2|b_id=2, ..., B:b3|a_id=2, B:b3|b_id=3, ..., B:b4|a_id=2, B:b4|b_id=4, ...
rowkey = 3, A:a_id=3, ..., B:b5|a_id=3, B:b5|b_id = 5

如何使用上述逻辑将此数据包导入hbase?
为了做到这一点,我需要生成动态列限定符名称,其数量将取决于数据包中的子偶的数量。

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题