猪的 bincod 评估 [英] bincod evaluation in pig

查看:26
本文介绍了猪的 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆