vvysotskyi commented on a change in pull request #1646: DRILL-6852: Adapt
current Parquet Metadata cache implementation to use Drill Metastore API
URL: https://github.com/apache/drill/pull/1646#discussion_r260208959
##########
File path:
exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/metadata/Metadata.java
##########
@@ -533,36 +536,27 @@ private ParquetFileMetadata_v3
getParquetFileMetadata_v3(ParquetTableMetadata_v3
/**
* Serialize parquet metadata to json and write to a file.
*
- * @param parquetTableMetadata parquet table metadata
+ * @param parquetTableMetadata parquet table or directory metadata
* @param p file path
+ * @param fs Drill file system
+ * @throws IOException if metadata can't be serialized
*/
- private void writeFile(ParquetTableMetadata_v3 parquetTableMetadata, Path p,
FileSystem fs) throws IOException {
+ private void writeFile(Object parquetTableMetadata, Path p, FileSystem fs)
throws IOException {
JsonFactory jsonFactory = new JsonFactory();
jsonFactory.configure(Feature.AUTO_CLOSE_TARGET, false);
jsonFactory.configure(JsonParser.Feature.AUTO_CLOSE_SOURCE, false);
ObjectMapper mapper = new ObjectMapper(jsonFactory);
SimpleModule module = new SimpleModule();
- module.addSerializer(ColumnMetadata_v3.class, new
ColumnMetadata_v3.Serializer());
+ if (parquetTableMetadata instanceof ParquetTableMetadata_v3) {
+ module.addSerializer(ColumnMetadata_v3.class, new
ColumnMetadata_v3.Serializer());
+ }
mapper.registerModule(module);
OutputStream os = fs.create(p);
mapper.writerWithDefaultPrettyPrinter().writeValue(os,
parquetTableMetadata);
os.flush();
os.close();
}
- private void writeFile(ParquetTableMetadataDirs parquetTableMetadataDirs,
Path p, FileSystem fs) throws IOException {
Review comment:
This method contains code almost the same as the previous one, so it was
removed and the previous one is used.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services