假设我的数据
row1 cats val12 val13
row2 dogs val22 val23
row3 cats val32 val33
...
data = load 'file' AS (row:chararry, pets:charray, val2:charray, val3:charray);
筛选数据以仅保存“cats”行
felines = filter data by (pets matches 'cats');
现在把“猫”改成“狮子”
lions = foreach felines generate replace (pets, 'cats', 'lions');
dump lions;
(lions)
(lions)
...
我的目标是创建新行以添加到表中
newFelines = foreach lions generate rows, lions, val1, val2;
Error ^^^^^
"Error during parsing. Scalars can be only used with projections"
如何获得具有以下新行的集合?
row1 lions val11 val12
row3 lions val31 val32
蒂亚,
1条答案
按热度按时间2w2cym1i1#
逐行:
没有“chararry”或“charray”数据类型:
提取“猫”:
用“狮子”代替“猫”可以这样做:
或者像这样: