how to include external jar file using PIG

好久不见. 提交于 2019-12-29 06:45:09

问题


When I run a mapreduce job using hadoop command, I use -libjars to setup my jar to the cache and the classpath. How to do something like this in PIG?


回答1:


register /local/path/to/myJar.jar



回答2:


There are two ways to add external jars to Pig environment.

  1. Use "-Dpig.additional.jars" to start Pig

    pig -Dpig.additional.jars=/local/path/to/your.jar

  2. Use "register" command in Pig scripts or grunt

    register /local/path/to/your.jar;

You can use any one according to your requirement.




回答3:


An extension to zsxwing's answer.
You can also specify multiple jar paths as

pig -Dpig.additional.jars="/local/path/1/*:/local/path/2/*"


来源:https://stackoverflow.com/questions/10423990/how-to-include-external-jar-file-using-pig

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