In hive, can a php custom reducer include another php file? -
let me explain actual problem using simple dummy problem. input: 1 2 3 4
output : 1 4 9 16
i write custom reducer process.php read every line , square numbers. square function readily available in other file lets utils.php can not require_once('utils.php') in process.php
hive query :
from ( select num1, num2 input )aa select transform(num1, num2) using 'process.php' num1,num2 ; i have tried doing on amazon aws infrastructure. no success. there no documentation this. appreciated. thanks.
i answering own question found fix problem. "require_once" indeed allowed in reducer script there catch.
let me name files clarity ...
reducer script : reducer.php
required file : utils.php
case 1: reducer.php , utils.php in same folder
require_once('utils.php') works.
case 2: reducer.php , utils.php in different folder
lets paths a/reducer.php , a/b/utils.php again, require_once('utils.php') works. require_once('b/utils.php') not needed, in fact require_once('b/utils.php') doesn't work.
reason: files added via 'add file' end in same directory on mapper/reducer.
Comments
Post a Comment