Sql4D - Arithmetic operations

Hi all,

I am currently testing Sql4D for pulling Data from Druid and generate various kind of reports.

I am experiencing some difficulties when trying to use arithmetic operations.

Here are some examples of queries I tried:

SELECT advertiser_id, LONG_SUM(clicks) as clicks, LONG_SUM(views) as views, LONG_SUM(clicks) / LONG_SUM(views) AS ctr FROM ad_events where interval between ‘2015-04-09T19:00:00’ AND ‘2015-04-09T20:00:00’ group by advertiser_id;

SELECT advertiser_id, LONG_SUM(clicks) as clicks, LONG_SUM(views) as views, views / clicks AS ctr FROM ad_events where interval between ‘2015-04-09T19:00:00’ AND ‘2015-04-09T20:00:00’ group by advertiser_id;

SELECT clicks / views AS test FROM ad_events where interval between ‘2015-04-09T19:00:00’ AND ‘2015-04-09T20:00:00’ LIMIT 100;

In all cases I get a “mismatched input ‘/’” error. I looked into the code and it seems arithmetic operations should be supported (druidGLexer class):

public final void mARITH_OPER() throws RecognitionException {
try {
int _type = ARITH_OPER;
int _channel = DEFAULT_TOKEN_CHANNEL;
// druidG.g:698:13: ( ( ‘’ | ‘+’ | ‘/’ | ‘-’ ) )
// druidG.g:
{
if ( (input.LA(1) >= '
’ && input.LA(1) <= ‘+’)||input.LA(1)==’-’||input.LA(1)==’/’ ) {
input.consume();
}
else {
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse);
throw mse;
}
}

state.type = _type;
state.channel = _channel;
}
finally {
// do for sure before leaving
}
}

``

Does anyone know how to perform arithmetic operations with Sql4D? My SQL query syntax must be wrong but I cannot figure out where. Also I didn’t find any example of SQL queries with arithmetic operations on the Sql4D: http://druidwithsql.tumblr.com/.

Any help would be greatly appreciated!