Apache Drill currently provides us an SQLLINE prompt where we can fire a lot of sql queries and see drill in action. Currently the parser is supporting a number of drill functions.
You might just feel like debugging few queries to gain some understanding of the query flow. Below is a crisp post for debugging the queries fired on sqlline prompt via java remote debugging.
1. Add debug parameters to Sqlline
We first need to start Drill sqlline with the debug parameters. We need to add the parameters in the ‘sqlline’ script file
$ cd incubator-drill
$ sudo gedit sqlline
In the script file locate the ‘exec’ command and add the following parameters:
-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
So now my sqlline script looks like this:
Note: you must be careful with the ‘suspend=y’ flag, it will pause your prompt while starting unless you attach a debugger to it. You can change it back to ‘suspend=n’ once you are done with debugging.
2. Using Eclipse for debugging
Got to the Run > Debug Configurations, and create a new Remote Java Application (by right clicking on the Remote Java Application section).
Provide any name for your project and keep the port as 8000, which is same as the port we provided in sqlline script.
3. Set few breakpoints
Now we are good to go for debugging. Just set few breakpoints in the sqlparser project. Few choices can be org.apache.drill.jdbc.Driver or org.apache.drill.jdbc.DrillHandler. Feel free to explore and try putting few breakpoints wildly.
4. Start Sqlline
Come back to your command prompt and start the sqlline shell by the usual command:
./sqlline -u jdbc:drill:schema=parquet-local -n admin -p admin
It should now hit your breakpoint on Eclipse. Have fun debugging the flow.
5. Have fun
Try out few queries on the sqlline prompt and play around. This step is important.
Cheers \m/
Hello,
I’m unable to find the location incubator-drill. Even /bin/sqlline do not have any of the contents shown in the image.
Can you please guide me on, where can i find that file to put this extra property for debugging.
Thanks In Advance,
Anji Rajesh