public ColumnStatistics getTableStats(final String catName, final String dbName,
      final String tableName, List<String> colNames, String engine,
      boolean enableBitVector, boolean enableKll) throws MetaException {
    if (colNames == null || colNames.isEmpty()) {
      return null;
    }
    final boolean doTrace = LOG.isDebugEnabled();
    final String queryText0 = "select " + getStatsList(enableBitVector, enableKll) + " from " + TAB_COL_STATS
          + " inner join " + TBLS + " on " + TAB_COL_STATS + ".\"TBL_ID\" = " + TBLS + ".\"TBL_ID\" "
          + " inner join " + DBS + " on " + TBLS + ".\"DB_ID\" = " + DBS + ".\"DB_ID\" "
          + " where " + DBS + ".\"CTLG_NAME\" = ? and " + DBS + ".\"NAME\" = ? and " + TBLS + ".\"TBL_NAME\" = ?"
          + " and \"ENGINE\" = ? and \"COLUMN_NAME\" in (";
    Batchable<String, Object[]> b = new Batchable<String, Object[]>() {
      @Override
      public List<Object[]> run(List<String> input) throws MetaException {
        String queryText = queryText0 + makeParams(input.size()) + ")";
        Object[] params = new Object[input.size() + 4];
        params[0] = catName;
        params[1] = dbName;
        params[2] = tableName;
        params[3] = engine;
        for (int i = 0; i < input.size(); ++i) {
          params[i + 4] = input.get(i);
        }
        long start = doTrace ? System.nanoTime() : 0;
        Query query = pm.newQuery("javax.jdo.query.SQL", queryText);
        try {
          Object qResult = executeWithArray(query, params, queryText);
          MetastoreDirectSqlUtils.timingTrace(doTrace, queryText0 + "...)", start, (doTrace ? System.nanoTime() : 0));
          if (qResult == null) {
            return null;
          }
          return MetastoreDirectSqlUtils.ensureList(qResult);
        } finally {
          addQueryAfterUse(query);
        }
      }
    };
    List<Object[]> list;
    try {
      list = Batchable.runBatched(batchSize, colNames, b);
      if (list != null) {
        list = new ArrayList<>(list);
      }
    } finally {
      b.closeAllQueries();
    }

    if (list == null || list.isEmpty()) {
      return null;
    }
    ColumnStatisticsDesc csd = new ColumnStatisticsDesc(true, dbName, tableName);
    csd.setCatName(catName);
    return makeColumnStats(list, csd, 0, engine);
  }
Retrieve the column statistics for the specified columns of the table. NULL
is returned if the columns are not provided.
@param catName     the catalog name of the table
@param dbName      the database name of the table
@param tableName   the table name
@param colNames    the list of the column names
@param engine      engine making the request
@return            the column statistics for the specified columns
@throws MetaException
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/MetaStoreDirectSql.java