private List<Long> getFunctionIds(String catName) throws MetaException {
    boolean doTrace = LOG.isDebugEnabled();

    String queryText = "select " + FUNCS + ".\"FUNC_ID\" from " + FUNCS +
        " LEFT JOIN " + DBS + " ON " + FUNCS + ".\"DB_ID\" = " + DBS + ".\"DB_ID\"" +
        " where " + DBS + ".\"CTLG_NAME\" = ? ";

    long start = doTrace ? System.nanoTime() : 0;
    Object[] params = new Object[1];
    params[0] = catName;
    try (QueryWrapper query = new QueryWrapper(pm.newQuery("javax.jdo.query.SQL", queryText))) {
      List<Object> sqlResult = executeWithArray(query.getInnerQuery(), params, queryText);
      long queryTime = doTrace ? System.nanoTime() : 0;
      MetastoreDirectSqlUtils.timingTrace(doTrace, queryText, start, queryTime);
      final List<Long> result;
      if (sqlResult.isEmpty()) {
        result = Collections.emptyList();
      } else {
        result = new ArrayList<>(sqlResult.size());
        for (Object fields : sqlResult) {
          result.add(MetastoreDirectSqlUtils.extractSqlLong(fields));
        }
      }
      return result;
    }
  }
Checks if the column descriptors still has references for other SD-s. If not, then removes
them. Should be called with the list short enough to not trip up Oracle/etc.
@param columnDescriptorIdList The column identifiers
@throws MetaException If there is an SQL exception during the execution it converted to
MetaException
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/MetaStoreDirectSql.java