Source:
<code><START> private List<Partition> convertFromPartSpec(Iterator<PartitionSpec> iterator, Table tbl) <END> throws HiveException, TException { if(!iterator.hasNext()) { return Collections.emptyList(); } List<Partition> results = new ArrayList<>(); while (iterator.hasNext()) { PartitionSpec partitionSpec = iterator.next(); if (partitionSpec.getPartitionList() != null) { Iterator<org.apache.hadoop.hive.metastore.api.Partition> externalPartItr = partitionSpec.getPartitionList().getPartitions().iterator(); while(externalPartItr.hasNext()) { org.apache.hadoop.hive.metastore.api.Partition msPart = externalPartItr.next(); results.add(new Partition(tbl, msPart)); } } else { for(PartitionWithoutSD partitionWithoutSD:partitionSpec.getSharedSDPartitionSpec().getPartitions()) { org.apache.hadoop.hive.metastore.api.Partition part = new org.apache.hadoop.hive.metastore.api.Partition(); part.setTableName(partitionSpec.getTableName()); part.setDbName(partitionSpec.getDbName()); part.setCatName(partitionSpec.getCatName()); part.setCreateTime(partitionWithoutSD.getCreateTime()); part.setLastAccessTime(partitionWithoutSD.getLastAccessTime()); part.setParameters(partitionWithoutSD.getParameters()); part.setPrivileges(partitionWithoutSD.getPrivileges()); part.setSd(partitionSpec.getSharedSDPartitionSpec().getSd().deepCopy()); String partitionLocation = null; if(partitionWithoutSD.getRelativePath() == null || partitionWithoutSD.getRelativePath().isEmpty()) { if (tbl.getDataLocation() != null) { Path partPath = new Path(tbl.getDataLocation(), Warehouse.makePartName(tbl.getPartCols(), partitionWithoutSD.getValues())); partitionLocation = partPath.toString(); } } else { partitionLocation = tbl.getSd().getLocation(); partitionLocation += partitionWithoutSD.getRelativePath(); } part.getSd().setLocation(partitionLocation); part.setValues(partitionWithoutSD.getValues()); part.setWriteId(partitionSpec.getWriteId()); Partition hivePart = new Partition(tbl, part); results.add(hivePart); } } } return results; }</code><technical_language>this static</technical_language>

Target:
private static List<Partition> convertFromPartSpec(Iterator<PartitionSpec> iterator, Table tbl) throws HiveException, TException { if(!iterator.hasNext()) { return Collections.emptyList(); } List<Partition> results = new ArrayList<>(); while (iterator.hasNext()) { PartitionSpec partitionSpec = iterator.next(); if (partitionSpec.getPartitionList() != null) { Iterator<org.apache.hadoop.hive.metastore.api.Partition> externalPartItr = partitionSpec.getPartitionList().getPartitions().iterator(); while(externalPartItr.hasNext()) { org.apache.hadoop.hive.metastore.api.Partition msPart = externalPartItr.next(); results.add(new Partition(tbl, msPart)); } } else { for(PartitionWithoutSD partitionWithoutSD:partitionSpec.getSharedSDPartitionSpec().getPartitions()) { org.apache.hadoop.hive.metastore.api.Partition part = new org.apache.hadoop.hive.metastore.api.Partition(); part.setTableName(partitionSpec.getTableName()); part.setDbName(partitionSpec.getDbName()); part.setCatName(partitionSpec.getCatName()); part.setCreateTime(partitionWithoutSD.getCreateTime()); part.setLastAccessTime(partitionWithoutSD.getLastAccessTime()); part.setParameters(partitionWithoutSD.getParameters()); part.setPrivileges(partitionWithoutSD.getPrivileges()); part.setSd(partitionSpec.getSharedSDPartitionSpec().getSd().deepCopy()); String partitionLocation = null; if(partitionWithoutSD.getRelativePath() == null || partitionWithoutSD.getRelativePath().isEmpty()) { if (tbl.getDataLocation() != null) { Path partPath = new Path(tbl.getDataLocation(), Warehouse.makePartName(tbl.getPartCols(), partitionWithoutSD.getValues())); partitionLocation = partPath.toString(); } } else { partitionLocation = tbl.getSd().getLocation(); partitionLocation += partitionWithoutSD.getRelativePath(); } part.getSd().setLocation(partitionLocation); part.setValues(partitionWithoutSD.getValues()); part.setWriteId(partitionSpec.getWriteId()); Partition hivePart = new Partition(tbl, part); results.add(hivePart); } } } return results; }