Execute Pig from within Java Application

こ雲淡風輕ζ 提交于 2019-12-10 10:47:58

问题


Is it possible to run Apache Pig jobs from within a Java application, without forking an external process?

It seems both Pig and Hadoop are written in Java but don't really offer Java APIs. Rather than relying on shell scripts, I'd rather use these tools form within a Java Spring application.


回答1:


See Spring Hadoop project and its Pig support.




回答2:


It seems there is Java API for Pig.

According to this API, there is a PigRunner class.

With that, you could easily add it to your Spring application, by creating a dedicated Spring bean.




回答3:


From what I've seen document wise and example wise is to you the PigServer class. They have examples of using it here: http://pig.apache.org/docs/r0.8.1/setup.html#Sample+Code



来源:https://stackoverflow.com/questions/9376261/execute-pig-from-within-java-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!