support "wide" format avg()