Apache pig 具有空值的Pig连接

Apache pig 具有空值的Pig连接,apache-pig,Apache Pig,在实现提供的解决方案时,我发现所有具有一个空列的行都被删除,这是Pig中的预期行为。我想知道下面的代码是否有效 A = B join by ( Bcol1 is null?'UNK',Bcol2 is null?'UNK',Bcol2 is null?999), C join by ( Ccol1 is null?'UNK',Ccol2 is null?'UNK',Ccol2 is null?999) 我收到一些解析错误。PIG是一种数据流脚本语言,添加额外的FOREACH GENERATE来

在实现提供的解决方案时,我发现所有具有一个空列的行都被删除,这是Pig中的预期行为。我想知道下面的代码是否有效

A = B join by ( Bcol1 is null?'UNK',Bcol2 is null?'UNK',Bcol2 is null?999),
C join by ( Ccol1 is null?'UNK',Ccol2 is null?'UNK',Ccol2 is null?999)

我收到一些解析错误。

PIG是一种数据流脚本语言,添加额外的FOREACH GENERATE来修复null不会导致额外的map reduce作业

B = foreach B generate ....., (Bcol1 is null) ? 'UNK' : Bcol1 as Bcol1, (Bcol2 is null) ? 'UNK' : Bcol2 as Bcol2, (Bcol3 is null) ? 999 : Bcol3;
C = foreach C generate ....., (Ccol1 is null) ? 'UNK' : Ccol1 as Ccol1, (Ccol2 is null) ? 'UNK' : Ccol2 as Ccol2, (Ccol3 is null) ? 999 : Ccol3;
A = join B by (Bcol1, Bcol2, Bcol3), C by (Ccol1, Ccol2, Ccol3);

感谢您对Alexejpab的响应,我确实以同样的方式在我这方面实现了,但是唯一的缺点是它将从null值本质上更改为某个确定性值,该值可能以值的形式呈现。。但我认为,由于连接中没有NVL函数。。这就是方法。您可以随时执行“(Bcol1为null)?“UNK”:Bcol1为JOIN\u Bcol1”,因此您可以使用更改的null值复制列,并在JOIN之后丢弃它们