ponder doing stats-based aggregations in metastore

Details

Description

StatsOptimizer currently fetches partition stats from metastore and then performs the aggregation. We could do some of these aggregations directly in metastore. It's probably not a very good idea to mess with SQL queries against underlying database, but at least if MS did the same loops we could avoid a bunch of network communication; that would be esp. good for tables with very large number of partitions.