Hadoop在条件下使用PIG语言添加其他行?

时间:2014-06-30 06:20:18

标签: hadoop row apache-pig add conditional-statements

任何人都可以帮助我使用Hadoop PIG脚本吗?基本上,我要做的是填补缺失的年份来填写每年的数据。我不知道如何正确填补失踪的岁月。 实际数据:

(Zambia, 2004, Health management & support workers, 0.994)
(Zambia, 2005, Health management & support workers, 0.033)
(Zambia, 2006, Health management & support workers, 0.928)
(Zambia, 2009, Health management & support workers, 0.071)
(Zambia, 2010, Health management & support workers, 0.036)

我想要的是什么:

(Zambia, 2001, Health management & support workers, 0.994)
(Zambia, 2002, Health management & support workers, 0.994)
(Zambia, 2003, Health management & support workers, 0.994)
(Zambia, 2004, Health management & support workers, 0.994)
(Zambia, 2005, Health management & support workers, 0.033)
(Zambia, 2006, Health management & support workers, 0.928)
(Zambia, 2007, Health management & support workers, 0.071)
(Zambia, 2008, Health management & support workers, 0.071)
(Zambia, 2009, Health management & support workers, 0.071)
(Zambia, 2010, Health management & support workers, 0.036)
(Zambia, 2011, Health management & support workers, 0.036)
(Zambia, 2012, Health management & support workers, 0.036)

这是我的代码:

  

b = LOAD' / dualcore / nomnom' AS(国家:chararray,年份:int,   工作:chararray,pertenthpeople:float); //加载上面显示的数据

     

c = GROUP b by(country,job);

     
    
      

INSERT CODE>>>

    
  
     

存储结果INTO' / dualcore / nomnomready';

非常感谢任何帮助。谢谢!

0 个答案:

没有答案