在pig文件系统中,我是否可以从我的unix目录执行shell脚本命令?
以下是如何在Pig脚本中运行shell命令的方法:
--declare a shell command
%declare command `shell_command`
file = LOAD 'file.txt' AS (colA:chararray, colB:int) ;
file_processed = FOREACH file GENERATE colA, colB, (command) AS colC ;
shell_command
执行的结果将会被保存在 command
中,在后续的 generate
步骤中会被替换。