????????????????????????????????????????????????????????????????????????????????????????锌????????????????械?????????

????????????????????椋�?????????????????????????????????????????????????

??????????????????????????????????????????????睢�

??????????????????????????写?????????????????????????????????????????????????写????????????????????????????????????????????

??????????????????????????????hive?????(????????hive?????????????????????????????椋�?????????霉?hive???????hive?????????sql???????)

????

????//?????????????????

????$input = "zhangsan|28|8000 ";//?????????????????

????$input.= "lisi|30|10000 "; //?????????????????

????$input.= "wangwu|40|20000 "; //??????????????????

????//???????????????

????file_put_contents('/tmp/staff.table'?? $input); //???????????写?????

????exec('hadoop fs -mkdir /table_path/staff/'); //??hadoop???????????????路??

????exec('hive -e "create external table stuff(name string?? age bigint?? salary bigint) partitioned by (dp string) location '/table_path/staff/dp=etao';"'); //????hive????????

????exec('hadoop fs -put /tmp/staff.table/table_path/staff/dp=etao/part-000'); //?????????????????hdfs??

????exec('hive -e "alter table staff add if not exists partition ( dp=etao ) location ’/table_path/staff/dp=etao’");//????alter table???????????????????????????????????(hive?????????)

????exec('underTestShell.sh'); //??斜???????

????exec('hadoop fs -cat /tmp/result.table/table_path/result/dp=etao/part-000 > /tmp/result.tmp'); //??????????????????

????$result = file_get_contents('/tmp/result.tmp); //??????????????

????//?????????????????

????assert::equal($result?? "38000");

?????>

????????????????????????????写????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????hive??????????????????????????????

???????????????????????????????懈?????????????????榉�????????????????????????????????????????????????????????????????????(???????????????????????????????懈???)????????????????????????????

????1. ??????????????????????????眉????????????????????????效???????????效???????????????????????????????????????????????????????????谢?????????????????????

????2. ?????????????????鈥�?????????????????锟�????????3?????????????????????????????????????hadoop?????路??????????????????????浠�????3?危??????300????????????????????????????????????????????????械??蔚谓??械??

????3. ?????hive?????????????写??????????????????????????伞???????????????椋�?????????????????????????谐???????hive????????????????????????????hive??????????2?????????????????????????????????????

???????????????????????????????????????????

????

????//?????????????????

????$input = "zhangsan|28|8000 ";

????$input.= "lisi|30|10000 ";

????$input.= "wangwu|40|20000 ";

????$underTest = new underTest();

????$result = $underTest->run();

????//?????????????????

????assert::equal($result['result']?? "38000");

?????>

???????????????????????????械??????????????run???????????????????????????????????????????????$input???写??$result??????????????????????????????????????械??????

??????????????????????????????????????

????UI??????????????????????????????????????????????????????????????????味?位???UI?????????????????????????????????????????????????霉????????????????

????????????????????????????????????????????????????????Mock????????????????????????????????

??????些???????????????????

?????????锟�??????小??????????????????????????????????????写??????????????????????????????????????????????????????????????????未???????????????????????????????????????????慰???????些????????????????????

???????????锟�??????????畏????????????????

???????????渭??????????????????????????????????????????????????????????????????????????????????