猪中的Bincod评估 [英] bincod evaluation in pig
本文介绍了猪中的Bincod评估的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试用一些预先计算的值替换缺失的值.
I am trying to replace the missing values with some precomputed value.
所以我在这里发布了问题,并遵循了建议,这是代码段
So i posted the question here and followed the advice and here is the code snippet
input = LOAD 'data.txt' USING PigStorage(',') AS
(
id1:double , id21:double );
gin = foreach input generate
id1 IS NULL ? 2 : id1,
id2 IS NULL ? 4 : id2;
但是我收到错误的输入'IS',期望SEMI_COLON吗?
But I am getting an error mismatched input 'IS' expecting SEMI_COLON?
推荐答案
尝试在bincond中添加括号.以下对我来说正常工作:
Try adding parentheses in the bincond. The following works properly for me:
input
的内容:
0.9,1.11
,0.3
10.3,
脚本:
inp = LOAD 'input' USING PigStorage(',') AS (id1:double, id2:double );
gin = foreach inp generate
((id1 IS NULL) ? 2 : id1),
((id2 IS NULL) ? 4 : id2);
DUMP gin;
输出:
(0.9,1.11)
(2.0,0.3)
(10.3,4.0)
这篇关于猪中的Bincod评估的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文