[SQL] sum and avg on empty table should always return null

So the optimizations are not valid. Also I think the optimization here is rarely encounter, so removing them will not have influence on performance.

I'll create JIRA after jira is back. Can we merge #3445 before I add a comparison test case from this?