private List<Function> getFunctionsFromFunctionIds(List<Long> funcIdList, String catName) throws MetaException {
    String funcIds = getIdListForIn(funcIdList);
    final int funcIdIndex = 0;
    final int funcNameIndex = 1;
    final int dbNameIndex = 2;
    final int funcClassNameIndex = 3;
    final int funcOwnerNameIndex = 4;
    final int funcOwnerTypeIndex = 5;
    final int funcCreateTimeIndex = 6;
    final int funcTypeIndex = 7;

    String queryText = "SELECT " +
        FUNCS + ".\"FUNC_ID\", " +
        FUNCS + ".\"FUNC_NAME\", " +
        DBS + ".\"NAME\", " +
        FUNCS + ".\"CLASS_NAME\", " +
        FUNCS + ".\"OWNER_NAME\", " +
        FUNCS + ".\"OWNER_TYPE\", " +
        FUNCS + ".\"CREATE_TIME\", " +
        FUNCS + ".\"FUNC_TYPE\"" +
        " FROM " + FUNCS +
        " LEFT JOIN " + DBS + " ON " + FUNCS + ".\"DB_ID\" = " + DBS + ".\"DB_ID\"" +
        " where " + FUNCS +".\"FUNC_ID\" in (" + funcIds + ") order by " + FUNCS + ".\"FUNC_NAME\" asc";

    List<Function> results = new ArrayList<>();
    TreeMap<Long, Function> funcs = new TreeMap<>();
    final boolean doTrace = LOG.isDebugEnabled();
    long start = doTrace ? System.nanoTime() : 0;
    try (QueryWrapper query = new QueryWrapper(pm.newQuery("javax.jdo.query.SQL", queryText))) {
      List<Object[]> queryResult = executeWithArray(query.getInnerQuery(), null, queryText);
      long end = doTrace ? System.nanoTime() : 0;
      MetastoreDirectSqlUtils.timingTrace(doTrace, queryText, start, end);

      for (Object[] function : queryResult) {
        Long funcId = MetastoreDirectSqlUtils.extractSqlLong(function[funcIdIndex]);
        String funcName = MetastoreDirectSqlUtils.extractSqlString(function[funcNameIndex]);
        String dbName = MetastoreDirectSqlUtils.extractSqlString(function[dbNameIndex]);
        String funcClassName = MetastoreDirectSqlUtils.extractSqlString(function[funcClassNameIndex]);
        String funcOwnerName = MetastoreDirectSqlUtils.extractSqlString(function[funcOwnerNameIndex]);
        String funcOwnerType = MetastoreDirectSqlUtils.extractSqlString(function[funcOwnerTypeIndex]);
        int funcCreateTime = MetastoreDirectSqlUtils.extractSqlInt(function[funcCreateTimeIndex]);
        int funcType = MetastoreDirectSqlUtils.extractSqlInt(function[funcTypeIndex]);

        Function func = new Function();
        func.setFunctionName(funcName);
        func.setDbName(dbName);
        func.setCatName(catName);
        func.setClassName(funcClassName);
        func.setOwnerName(funcOwnerName);
        func.setOwnerType(PrincipalType.valueOf(funcOwnerType));
        func.setCreateTime(funcCreateTime);
        func.setFunctionType(FunctionType.findByValue(funcType));
        func.setResourceUris(new ArrayList<>());

        results.add(func);
        funcs.put(funcId, func);
      }
    }
    MetastoreDirectSqlUtils.setFunctionResourceUris(FUNC_RU, pm, funcIds, funcs);
    return results;
  }
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