有没有人知道在cpython脚本中嵌入pig的方法,类似于RDBMS的方法?我找过了,但没找到。
我不想使用jython,因为我正在尝试使用Jython中不提供的各种cpython库来处理数据。
发布于 2013-09-27 01:58:30
最近在Pig 0.12中添加了对CPython的支持:http://blog.mortardata.com/post/62334142398/hadoop-python-pig-trunk
发布于 2012-08-23 07:47:19
发布于 2013-09-29 11:02:44
如果您所说的“类似于RDBMS可用的API”指的是API,那么您可以使用子进程构建一个对象模型。我在过去使用过类似下面的东西。
import subprocess
from subprocess import Popen, PIPE
def execute(command):
print command + "\n"
p = subprocess.Popen(command, stdout=subprocess.PIPE, shell=True)
stdout, stderr = p.communicate()
print stdout
return p.returncode
command = "pig.9 -p input=" + input + "/* -p output=" + output + " -f my.pig"
execute(command)https://stackoverflow.com/questions/12077566
复制相似问题