private int buildQueryForSingleValuedFields(List<Long> partitionIds, StringBuilder queryTextBuilder) {
    queryTextBuilder.append("select ");
    // build projection columns using the ProjectedFields
    // it should not matter if you select all the
    List<String> columnList = getSingleValuedColumnNames(roots);
    queryTextBuilder.append(Joiner.on(',').join(columnList));
    queryTextBuilder.append(SPACE);
    queryTextBuilder.append("from " + PARTITIONS);
    // if SD fields are selected add join clause with SDS
    boolean foundSD = false;
    if (find(SD_PATTERN)) {
      queryTextBuilder.append(SPACE);
      queryTextBuilder.append(
          "left outer join " + SDS + " on " + PARTITIONS + ".\"SD_ID\" = " + SDS + ".\"SD_ID\"");
      foundSD = true;
    }
    // if serde fields are selected add join clause on serdes
    if (foundSD || find(SERDE_PATTERN)) {
      queryTextBuilder.append(SPACE);
      queryTextBuilder.append(
          "  left outer join " + SERDES + " on " + SDS + ".\"SERDE_ID\" = " + SERDES
              + ".\"SERDE_ID\"");
    }
    queryTextBuilder.append(SPACE);
    //add where clause
    queryTextBuilder.append("where \"PART_ID\" in (" + Joiner.on(',').join(partitionIds)
        + ") order by \"PART_NAME\" asc");
    return columnList.size();
  }
Given a list of partition ids, returns the List of partially filled partitions based on the
projection list used to instantiate this PartitionProjectionEvaluator
@param partitionIds List of partition ids corresponding to the Partitions objects which are requested
@return Partitions where each partition has only the projected fields set
@throws MetaException
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/PartitionProjectionEvaluator.java