Debugging Hive
Here, we will take a quick look at the command-line debugging option in Hive.
Getting ready
Hive code could be debugged by assigning a port to Hive and adding socket details to Hive JVM. To add debugging configuration to Hive, execute the following properties on an OS terminal or add it to bash_profile
of the user:
export HIVE_DEBUG_PORT=8000 export HIVE_DEBUG="-Xdebug -Xrunjdwp:transport=dt_socket,address=${HIVE_DEBUG_PORT},server=y,suspend=y"
How to do it...
Once a debug port is attached to Hive and Hive server suspension is enabled at startup, the following steps will help you debug Hive queries:
- After defining previously mentioned properties, run the Hive CLI in debug mode:
hive --debug
- If you have written up your own
Test
class and want to execute unit test cases written in that class, then you need to execute the following command specifying the class name you want to execute:mvn test -Dtest=ClassName