Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: trivial edits of the Debugging section (thanks, Swarnim)

...

How do I import into Eclipse?

Build and generate Eclipse files (the conservative method):

...

You can debug into a single JUnit test in Eclipse by first making sure you've built the Eclipse files and imported the project into Eclipse as described here. Then set one or more breakpoints, highlight the method name of the JUnit test method you want to debug into, and do Run->Debug.

Another useful method to debug these tests is to attach a remote debugger. When you run the test, enable the debug mode for surefire by passing in the "-Dmaven.surefire.debug". Additional details on how to turning on debugging for surefire can be found here. Now when you run the tests, it will now wait with a message similar to

...

Note that this assumes that you are still using the default port 5005 for surefire. Otherwise you might see a different port. Once you see this message, in eclipse Eclipse right click on the project you want to debug, go to "Debug As -> Debug Configurations -> Remote Java Application" and hit the "+" sign on far left top. This should bring up a dialog box. Make sure that the host is "localhost" and the port is "5005". Before you start debugging, make sure that you have set appropriate debug breakpoints in the code. Once ready, hit "Debug". Now if you go back to the terminal, you should see the tests running and they will stop at the breakpoints that you set for you to debugdebugging.

How do I debug my queries in

...

Hive?

You can also interactively debug your queries in hive. Hive by attaching a remote debugger. To do so, start beeline with "–debug Beeline with the "--debug" option.

No Format
$ beeline --debug
Listening for transport dt_socket at address: 8000

Once you see this message, in eclipse Eclipse right click on the project you want to debug, go to "Debug As -> Debug Configurations -> Remote Java Application" and hit the "+" sign on far left top. This should bring up a dialog box. Make sure that the host is the host on which beeline the Beeline CLI is running and the port is "8000". Before you start debugging, make sure that you have set appropriate debug breakpoints in the code. Once ready, hit "Debug". The remote debugger should attach to beeline Beeline and proceed.

No Format
$ beeline --debug
Listening for transport dt_socket at address: 8000
Beeline version 1.2.0 by Apache Hive
beeline>

...

This method should work great if your queries are simple fetch queries that do not kick off mapreduce MapReduce jobs. If a query runs in a distributed mode, it becomes very hard to debug. Therefore, it is advisable to run in a "local" mode for debugging. In order to run hive Hive in local mode, do the following:

...