【发布时间】:2015-02-20 20:25:43
【问题描述】:
我正在尝试通过提供 Python 脚本作为映射器来测试 Hive TRANSFORM。我的配置单元脚本是:
add file /full/path/to/mapper.py;
set mapred.job.queue.name=queue_name;
use my_database;
select transform(s.year, s.month, s.day, s.hour)
using 'mapper.py'
from my_table s limit 10;
而我的 Python 映射器脚本只是试图回显输入:
#!/usr/local/bin/python
import sys
for line in sys.stdin:
print line
我尝试使用以下组合来运行它:
删除 hive 脚本中的
add file ...并在select ...语句中提供mapper.py的完整路径保留
add file ...和映射器的完整路径:/path/to/mapper.py保留
add file ...和映射器的相对路径:./mapper.py尝试使用
AS子句(using 'mapper.py' as line)选择映射器输出
到目前为止,上述所有尝试都导致 Hive 报告它无法初始化我的自定义脚本:
FAILED: Execution Error, return code 20000 from org.apache.hadoop.hive.ql.exec.mr.MapRedTask. Unable to initialize custom script.
我无法理解这种“初始化”的性质。 Hive 不能吗
- 找到我的脚本(即路径问题)?
- 找到python可执行文件(即
#!shebang)
我正在关注Hive tutorial 中的“自定义映射/缩减脚本”。
【问题讨论】:
-
您可能会通过从 JobTracker 或 ResourceManager(取决于您使用的 MR 版本)查看底层 MapReduce 作业的日志来获得更多信息。