Hello, everyone. Thanks for coming back again to continue with this certification series. In the last tutorial, we saw how to run any pig script with TEZ as the execution mode. In this tutorial, we are going to see how to register a JAR file to use the User Defined Function written and packages inside it.
Let us begin then.
For registering the jar file, we will first find out the desired jar file to register.
The jar file, for this tutorial, is called piggybank.jar file which comes with pig library.
We can use the following command to find out the path of this piggybank.jar file.
find / | grep “piggybank.jar”
You can see that the output of the above command looks as follows.
As you can see from the above screenshot that the absolute path of the jar file is /usr/hdp/126.96.36.199-2557/pig/piggybank.jar. Therefore, we can use this absolute path for registering the jar file.
For doing so, you can use the following command in the Apache Pig grunt shell.
The output of this commands looks something like this.
As you can see from the above screenshot, there is no output once you execute the REGISTER command. It means that the jar file was registered successfully and you do not need to worry about it.
You believe it or not, but we have reached the end of this tutorial. You can see how easy it was to successfully register the desired jar file in Apache Pig for using the User Defined Functions packaged in it.
Hope both of these commands and screenshots help you to understand the concept of Jar file registration in Apache Pig.
Please follow my blog for further updates. In the next tutorial, we are going to see how to assign an alias for a function stored in the jar file.
Please check out my website at www.milindjagre.com