Hadoop流式传输php环境变量

时间:2012-04-21 23:53:59

标签: php hadoop

如何使用php在mapper中获取输入文件名?

1 个答案:

答案 0 :(得分:0)

如上所述here,对于php,map-reduce的模板是:

01  function map ($filename, $content) {
02      foreach (explode('', $content) as $word) {
03          collect($word, 1);
04      }
05  }
06   
07  function reduce($word, $values) {
08      $numWordCount = 0;
09   
10      foreach ($values as $value) {
11          $numWordCount += $value;
12      }
13   
14      collect($word, $numWordCount);

现在,$filename的值不能是printed inside a php function吗?