Skip to content

Commit

Permalink
PARQUET-2466: Simplify logic when calling ParquetWriter (apache#1338)
Browse files Browse the repository at this point in the history
I think this is easier to read
  • Loading branch information
Fokko authored and clairemcginty committed May 17, 2024
1 parent de01478 commit 0decc2b
Showing 1 changed file with 15 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -911,33 +911,21 @@ public ParquetWriter<T> build() throws IOException {
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);
}
}
}

0 comments on commit 0decc2b

Please sign in to comment.