public static Statistics collectStatistics(HiveConf conf, PrunedPartitionList partList, ColumnStatsList colStatsCache,
      Table table, TableScanOperator tableScanOperator) throws HiveException {

    // column level statistics are required only for the columns that are needed
    List<ColumnInfo> schema = tableScanOperator.getSchema().getSignature();
    List<String> neededColumns = tableScanOperator.getNeededColumns();
    List<String> referencedColumns = tableScanOperator.getReferencedColumns();

    return collectStatistics(conf, partList, table, schema, neededColumns, colStatsCache, referencedColumns);
  }
Collect table, partition and column level statistics
@param conf
         - hive configuration
@param partList
         - partition list
@param table
         - table
@param tableScanOperator
         - table scan operator
@return statistics object
@throws HiveException
ql/src/java/org/apache/hadoop/hive/ql/stats/StatsUtils.java