public static Map<Path, PartitionDetails> getFullDPSpecs(Configuration conf, DynamicPartitionCtx dpCtx,
      Map<String, List<Path>> dynamicPartitionSpecs) throws HiveException {

    try {
      Path loadPath = dpCtx.getRootPath();
      FileSystem fs = loadPath.getFileSystem(conf);
      int numDPCols = dpCtx.getNumDPCols();
      Map<Path, Optional<List<Path>>> allPartition = new HashMap<>();
      if (dynamicPartitionSpecs != null) {
        for (Map.Entry<String, List<Path>> partSpec : dynamicPartitionSpecs.entrySet()) {
          allPartition.put(new Path(loadPath, partSpec.getKey()), Optional.of(partSpec.getValue()));
        }
      } else {
        List<FileStatus> status = HiveStatsUtils.getFileStatusRecurse(loadPath, numDPCols, fs);
        for (FileStatus fileStatus : status) {
          allPartition.put(fileStatus.getPath(), Optional.empty());
        }
      }

      if (allPartition.isEmpty()) {
        LOG.warn("No partition is generated by dynamic partitioning");
        return Collections.synchronizedMap(new LinkedHashMap<>());
      }
      validateDynPartitionCount(conf, allPartition.keySet());

      // partial partition specification
      Map<String, String> partSpec = dpCtx.getPartSpec();

      // list of full partition specification
      Map<Path, PartitionDetails> partitionDetailsMap =
          Collections.synchronizedMap(new LinkedHashMap<>());

      // calculate full path spec for each valid partition path
      for (Map.Entry<Path, Optional<List<Path>>> partEntry : allPartition.entrySet()) {
        Path partPath = partEntry.getKey();
        Map<String, String> fullPartSpec = Maps.newLinkedHashMap(partSpec);
        String staticParts =  Warehouse.makeDynamicPartName(partSpec);
        Path computedPath = partPath;
        if (!staticParts.isEmpty() ) {
          computedPath = new Path(new Path(partPath.getParent(), staticParts), partPath.getName());
        }
        if (!Warehouse.makeSpecFromName(fullPartSpec, computedPath, new HashSet<>(partSpec.keySet()))) {
          Utilities.FILE_OP_LOGGER.warn("Ignoring invalid DP directory " + partPath);
        } else {
          PartitionDetails details = new PartitionDetails();
          details.fullSpec = fullPartSpec;
          if (partEntry.getValue().isPresent()) {
            details.newFiles = new ArrayList<>();
            for (Path filePath : partEntry.getValue().get()) {
              details.newFiles.add(fs.getFileStatus(filePath));
            }
          }
          partitionDetailsMap.put(partPath, details);
        }
      }
      return partitionDetailsMap;
    } catch (IOException e) {
      throw new HiveException(e);
    }
  }
Construct a list of full partition spec from Dynamic Partition Context and the directory names
corresponding to these dynamic partitions.
ql/src/java/org/apache/hadoop/hive/ql/exec/Utilities.java