Fix https://github.com/julianhyde/optiq/issues/232, "Sum and avg of empty set should be null as per SQL specification".

We achieve this by replacing 'SUM(x)' by 'CASE COUNT(*) = 0 THEN NULL ELSE SUM0(x) END' if it is possible for the group to be empty (either x is nullable or the aggregate query applies to the whole table), where SUM0 is an aggregate operator similar to SUM but returns 0 if applied to the empty set.