gpt4 book ai didi

hadoop - Hadoop Pig FULL加入

转载 作者:行者123 更新时间:2023-12-02 21:44:36 24 4
gpt4 key购买 nike

我是PIG的初学者。我的问题是加入后:

ALLDATA1 = join dataA1 by subject FULL, dataT1 by subject;
ALLDATA2 = join ALLDATA1 by dataA1::subject FULL, dataR1 by subject;

我有3栏
ALLDATA1::dataA1::subject, 
ALLDATA1::dataT1::subject,
dataR1::subject

我需要所有这些。因为当一个空时,另一个却不空。如何将所有主题放在一列中加入?或在以下情况下热合并此列:当ALLDATA1::dataA1::subject为空时,请使用另一个。

谢谢

最佳答案

获得3列输出后,可以使用三元运算符(是其他常规语言的运算符)来组合3列以生成1。如下所示:

ALLDATA1 = join dataA1 by subject FULL, dataT1 by subject;
ALLDATA2 = join ALLDATA1 by dataA1::subject FULL, dataR1 by subject;

ALLDATA3 = FOREACH ALLDATA2
GENERATE
ALLDATA1::dataA1::subject IS NOT NULL ?
ALLDATA1::dataA1::subject :
(ALLDATA1::dataT1::subject IS NOT NULL ?
ALLDATA1::dataT1::subject :
dataR1::subject
) AS subjet;

希望这可以帮助。

关于hadoop - Hadoop Pig FULL加入,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26475988/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com