You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@parquet.apache.org by GitBox <gi...@apache.org> on 2021/03/16 14:33:53 UTC

[GitHub] [parquet-mr] shangxinli commented on a change in pull request #881: PARQUET-1999: NPE might occur if OutputFile is implemented by the client

shangxinli commented on a change in pull request #881:
URL: https://github.com/apache/parquet-mr/pull/881#discussion_r595227345



##########
File path: parquet-hadoop/src/main/java/org/apache/parquet/hadoop/ParquetWriter.java
##########
@@ -281,8 +281,9 @@ public ParquetWriter(Path file, Configuration conf, WriteSupport<T> writeSupport
 
     // encryptionProperties could be built from the implementation of EncryptionPropertiesFactory when it is attached.
     if (encryptionProperties == null) {
+      String path = file == null ? null : file.getPath();
       encryptionProperties = ParquetOutputFormat.createEncryptionProperties(conf,
-          file == null ? null : new Path(file.getPath()), writeContext);
+          path == null ? null : new Path(path), writeContext);

Review comment:
       Instead of checking 'null' twice, can we do it like this? 
   Path path = (file == null) ? null : new Path(file.getPath());




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org