Tips for Debugging CCL Script
The streaming design time tools in HANA Studio or ESP Studio provide several tools to help you debug CCL, including stream viewer, the manual input tool (to input a single event at a time), the event tracer and the breakpoint tool. My workhorse is the combination of streamviewer, event tracers and the manual input tool: open viewers on the relevant streams, connect the event tracer, and then send in events one at a time from the manual input tool. You can see output in the stream viewers and you can see incremental windows in the event tracer.
But, when you get into CCL Script, within a Flex operator or a custom function, debugging can be tricky. Unfortunately, the tools available for debugging scripts in a Flex or custom fuction are limited – and yes, that is something we want to address in the roadmap. But there are more tools available now than you may be aware of – they’re not obvious. So I thought I’d tell you about them.
OK, yeah, I know, it’s a pretty crude tool for debugging, but hey – it’s easy to use and it works. You can add PRINT statements wherever you like in your CCL Script. example:
PRINT (‘some text’, inrecord.column1);
If you’re running ESP and running locally, that’s easy enough – it prints to stdout. But what if you are using SDS? Where do you find the output? Good news: it’s easy – you just have to know where to look:
In SAP HANA Studio, double click on your HANA system in the Systems view to open the Administration view. Go to the “Diagnosis Files” tab. Here you will fine trace files for your streaming projects. Open the trace file for your project to see the output from any PRINT statements you put in your project.
OK, now for something a bit more advanced…
Hidden away in the Smart Data Streaming Utilities Guide is a chapter on Advanced Debugging. This tells you about command line tools that give you the ability to do things like examine variables and data structures. You do this using the streamingprojectclient command line tool. Note that the project has to be running in trace mode (turn trace mode on using the streamingprojectclient tool). See these notes on data examination.