@Override
      public void apply(StorageDescriptor t, Object[] fields) throws MetaException {
        if (!t.isSetSkewedInfo()) t.setSkewedInfo(new SkewedInfo());
        // Note that this is not a typical list accumulator - there's no call to finalize
        // the last list. Instead we add list to SD first, as well as locally to add elements.
        if (fields[1] == null) {
          currentList = null; // left outer join produced a list with no values
          currentListId = null;
          t.getSkewedInfo().addToSkewedColValues(Collections.<String>emptyList());
        } else {
          long fieldsListId = extractSqlLong(fields[1]);
          if (currentListId == null || fieldsListId != currentListId) {
            currentList = new ArrayList<String>();
            currentListId = fieldsListId;
            t.getSkewedInfo().addToSkewedColValues(currentList);
          }
          currentList.add((String)fields[2]);
        }
      }
Merges applies the result of a PM SQL query into a tree of object.
Essentially it's an object join. DN could do this for us, but it issues queries
separately for every object, which is suboptimal.
@param pm
@param tree The object tree, by ID.
@param queryText The query text.
@param keyIndex Index of the Long column corresponding to the map ID in query result rows.
@param func The function that is called on each (object,row) pair with the same id.
@return the count of results returned from the query.
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/MetastoreDirectSqlUtils.java