code: @Override
    protected TimestampedHiveDatasetVersion getDatasetVersion(Partition partition) {
  
      int index = Iterables.indexOf(partition.getTable().getPartitionKeys(), this.partitionKeyNamePredicate);
  
      if (index == -1) {
        throw new IllegalArgumentException(String
            .format("Failed to find partition key %s in the table %s", this.partitionKeyName,
                partition.getTable().getCompleteName()));
      }
  
      if (index >= partition.getValues().size()) {
        throw new IllegalArgumentException(String
            .format("Failed to find partition value for key %s in the partition %s", this.partitionKeyName,
                partition.getName()));
      }
      return new TimestampedHiveDatasetVersion(
          this.formatter.parseDateTime(partition.getValues().get(index).trim().substring(0, this.pattern.length())),
          partition);
    }
docs: Create a {@link TimestampedHiveDatasetVersion} from a {@link Partition}. The hive table is expected
  to be date partitioned by {@link #partitionKeyName}. The partition value format must be {@link #pattern}
  
  @throws IllegalArgumentException when {@link #partitionKeyName} is not found in the <code></code>
  @throws IllegalArgumentException when a value can not be found for {@link #partitionKeyName} in the <code>partition</code>
  @throws IllegalArgumentException if the partition value can not be parsed with {@link #pattern}
  {@inheritDoc}