[ 
https://issues.apache.org/jira/browse/PARQUET-1999?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17302575#comment-17302575
 ] 

ASF GitHub Bot commented on PARQUET-1999:
-----------------------------------------

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:
[email protected]


> NPE might occur if OutputFile is implemented by the client
> ----------------------------------------------------------
>
>                 Key: PARQUET-1999
>                 URL: https://issues.apache.org/jira/browse/PARQUET-1999
>             Project: Parquet
>          Issue Type: Bug
>    Affects Versions: 1.12.0
>            Reporter: Gabor Szadovszky
>            Assignee: Gabor Szadovszky
>            Priority: Blocker
>
> We have introduced a new default method in 
> [OutputFile|https://github.com/apache/parquet-mr/blob/apache-parquet-1.12.0-rc3/parquet-common/src/main/java/org/apache/parquet/io/OutputFile.java#L34-L36]
>  which returns {{null}} by default. Unfortunately we not always prepared for 
> this {{null}} causing NPE in case of this interface is implemented by our API 
> client. (Our own implementations overrides this method and returns non-null 
> values.)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to