return new ParquetMetadata(new parquet.hadoop.metadata.FileMetaData(messageType, keyValueMetaData, fileMetaData.getCreated_by()), blocks);
/** * 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 */ 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); }
/** * ends a file once all blocks have been written. * closes the file. * @param extraMetaData the extra meta data to write in the footer * @throws IOException */ public void end(Map<String, String> extraMetaData) throws IOException { state = state.end(); if (DEBUG) LOG.debug(out.getPos() + ": end"); ParquetMetadata footer = new ParquetMetadata(new FileMetaData(schema, extraMetaData, Version.FULL_VERSION), blocks); serializeFooter(footer, out); out.close(); }
/** * ends a file once all blocks have been written. * closes the file. * @param extraMetaData the extra meta data to write in the footer * @throws IOException */ public void end(Map<String, String> extraMetaData) throws IOException { state = state.end(); if (DEBUG) LOG.debug(out.getPos() + ": end"); ParquetMetadata footer = new ParquetMetadata(new FileMetaData(schema, extraMetaData, Version.FULL_VERSION), blocks); serializeFooter(footer, out); out.close(); }
long fileSize = fileToStore.length(); String size = (fileSize > 1024) ? (fileSize/1024) + "Kb" : fileSize + "b"; fileMetaData = new FileMetaData(fileName, size, true);
return new ParquetMetadata(new parquet.hadoop.metadata.FileMetaData(messageType, keyValueMetaData, fileMetaData.getCreated_by()), blocks);
new parquet.hadoop.metadata.FileMetaData(messageType, keyValueMetaData, parquetMetadata.getCreated_by()), blocks);