public FileMetaData merge() {
    String createdByString = createdBy.size() == 1 ?
      createdBy.iterator().next() :
      createdBy.toString();
    Map<String, String> mergedKeyValues = new HashMap<String, String>();
    for (Entry<String, Set<String>> entry : keyValueMetaData.entrySet()) {
      if (entry.getValue().size() > 1) {
        throw new RuntimeException("could not merge metadata: key " + entry.getKey() + " has conflicting values: " + entry.getValue());
      }
      mergedKeyValues.put(entry.getKey(), entry.getValue().iterator().next());
    }
    return new FileMetaData(schema, mergedKeyValues, createdByString);
  }
public FileMetaData merge() {
    String createdByString = createdBy.size() == 1 ?
      createdBy.iterator().next() :
      createdBy.toString();
    Map<String, String> mergedKeyValues = new HashMap<String, String>();
    for (Entry<String, Set<String>> entry : keyValueMetaData.entrySet()) {
      if (entry.getValue().size() > 1) {
        throw new RuntimeException("could not merge metadata: key " + entry.getKey() + " has conflicting values: " + entry.getValue());
      }
      mergedKeyValues.put(entry.getKey(), entry.getValue().iterator().next());
    }
    return new FileMetaData(schema, mergedKeyValues, createdByString);
  }
public FileMetaData merge ( ) { String createdByString = createdBy . size ( ) == 1 ? createdBy . iterator ( ) . next ( ) : createdBy . toString ( ) ; Map < String , String > mergedKeyValues = new HashMap < String , String > ( ) ; for ( Entry < String , Set < String > > entry : keyValueMetaData . entrySet ( ) ) { if ( entry . getValue ( ) . size ( ) > 1 ) { throw new RuntimeException ( "could not merge metadata: key " + entry . getKey ( ) + " has conflicting values: " + entry . getValue ( ) ) ; } mergedKeyValues . put ( entry . getKey ( ) , entry . getValue ( ) . iterator ( ) . next ( ) ) ; } return new FileMetaData ( schema , mergedKeyValues , createdByString ) ; }
Will merge the metadata as if it was coming from a single file.
(for all part files written together this will always work)
If there are conflicting values an exception will be thrown
@return the merged version of this
Will merge the metadata as if it was coming from a single file . ( for all part files written together this will always work ) If there are conflicting values an exception will be thrown