This is an automated email from the ASF dual-hosted git repository.
gangwu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/parquet-mr.git
The following commit(s) were added to refs/heads/master by this push:
new 3912bd259 PARQUET-2466: Simplify logic when calling `ParquetWriter`
(#1338)
3912bd259 is described below
commit 3912bd259516761a6a220c028b105937371a9a12
Author: Fokko Driesprong <[email protected]>
AuthorDate: Thu May 16 06:55:49 2024 +0200
PARQUET-2466: Simplify logic when calling `ParquetWriter` (#1338)
I think this is easier to read
---
.../org/apache/parquet/hadoop/ParquetWriter.java | 42 ++++++++--------------
1 file changed, 15 insertions(+), 27 deletions(-)
diff --git
a/parquet-hadoop/src/main/java/org/apache/parquet/hadoop/ParquetWriter.java
b/parquet-hadoop/src/main/java/org/apache/parquet/hadoop/ParquetWriter.java
index 5c7fcaa22..911288988 100644
--- a/parquet-hadoop/src/main/java/org/apache/parquet/hadoop/ParquetWriter.java
+++ b/parquet-hadoop/src/main/java/org/apache/parquet/hadoop/ParquetWriter.java
@@ -911,33 +911,21 @@ public class ParquetWriter<T> implements Closeable {
if (codecFactory == null) {
codecFactory = new CodecFactory(conf,
encodingProps.getPageSizeThreshold());
}
- if (file != null) {
- return new ParquetWriter<>(
- file,
- mode,
- getWriteSupport(conf),
- codecName,
- codecFactory,
- rowGroupSize,
- enableValidation,
- conf,
- maxPaddingSize,
- encodingProps,
- encryptionProperties);
- } else {
- return new ParquetWriter<>(
- HadoopOutputFile.fromPath(path,
ConfigurationUtil.createHadoopConfiguration(conf)),
- mode,
- getWriteSupport(conf),
- codecName,
- codecFactory,
- rowGroupSize,
- enableValidation,
- conf,
- maxPaddingSize,
- encodingProps,
- encryptionProperties);
- }
+
+ return new ParquetWriter<>(
+ (file != null)
+ ? file
+ : HadoopOutputFile.fromPath(path,
ConfigurationUtil.createHadoopConfiguration(conf)),
+ mode,
+ getWriteSupport(conf),
+ codecName,
+ codecFactory,
+ rowGroupSize,
+ enableValidation,
+ conf,
+ maxPaddingSize,
+ encodingProps,
+ encryptionProperties);
}
}
}