diff --git a/parquet-hadoop/src/main/java/org/apache/parquet/hadoop/rewrite/ParquetRewriter.java b/parquet-hadoop/src/main/java/org/apache/parquet/hadoop/rewrite/ParquetRewriter.java index 4d27b705d1..7ced56d566 100644 --- a/parquet-hadoop/src/main/java/org/apache/parquet/hadoop/rewrite/ParquetRewriter.java +++ b/parquet-hadoop/src/main/java/org/apache/parquet/hadoop/rewrite/ParquetRewriter.java @@ -176,9 +176,12 @@ public ParquetRewriter( this.writer = writer; this.outSchema = outSchema; this.newCodecName = codecName; - originalCreatedBy = originalCreatedBy == null ? meta.getFileMetaData().getCreatedBy() : originalCreatedBy; - extraMetaData = meta.getFileMetaData().getKeyValueMetaData(); - extraMetaData.put(ORIGINAL_CREATED_BY_KEY, originalCreatedBy); + extraMetaData = new HashMap<>(meta.getFileMetaData().getKeyValueMetaData()); + extraMetaData.put( + ORIGINAL_CREATED_BY_KEY, + originalCreatedBy != null + ? originalCreatedBy + : meta.getFileMetaData().getCreatedBy()); if (maskColumns != null && maskMode != null) { this.maskColumns = new HashMap<>(); for (String col : maskColumns) {