Keep in mind that the return value of the sql() function is VARCHAR. The result of the query itself is a number but DS does an implicit conversion to VARCHAR.
If you were to write query like this (assuming Oracle):
$g_max_row_num = sql( ‘ig_src’, ‘select cast(max(row_num) as VARCHAR2(10)) from av.event_new’ );
The variable may end up with a value without the comma.