Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
FOREACH如果语句中的预期字段为空(null),我想选择不同的字段。Pig中有类似NULLIF(来自SQL)的东西吗?
FOREACH
NULLIF
听起来您正在寻找bincond和null 运算符。你可以像这样使用它:
DUMP A ; -- (foo,) -- (,bar) -- (bing,bang) -- (,) -- (bosh,) B = FOREACH A GENERATE ($0 is not null? $0 : $1) AS result ; DUMP B ; -- (foo) -- (bar) -- (bing) -- () <-- Note this value is a null -- (bosh)