[ 
https://issues.apache.org/jira/browse/PARQUET-145?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

wolfgang hoschek updated PARQUET-145:
-------------------------------------
    Description: 
InternalParquetRecordReader.close() currently throws a NullPointerException if 
initialize() didn't succeed and hence the "reader" remains null. 

This NPE happens with client usage idioms like this:

{code}
AvroParquetReader reader = ...
try {
       // read some parquet data
} finally {
  if (reader != null) { reader.close(); }
}
{code}

I believe close() should read as follows:

{code}
public void close() throws IOException {
    if (reader != null) {
      reader.close();
    }
  }
{code}

Thoughts?

  was:
InternalParquetRecordReader.close() currently throws a NullPointerException if 
initialize() didn't succeed and hence the "reader" remains null. 

This NPE happens with client usage idioms like this:

{code}
AvroParquetReader reader = ...
try {
       // read some parquet data
} finally {
  if (reader != null) { reader.close(); }
}

I believe close() should read as follows:

{code}
public void close() throws IOException {
    if (reader != null) {
      reader.close();
    }
  }
{code}

Thoughts?


> InternalParquetRecordReader.close() should not throw an exception if 
> initialization has failed
> ----------------------------------------------------------------------------------------------
>
>                 Key: PARQUET-145
>                 URL: https://issues.apache.org/jira/browse/PARQUET-145
>             Project: Parquet
>          Issue Type: Bug
>          Components: parquet-mr
>    Affects Versions: parquet-mr_1.6.0
>            Reporter: wolfgang hoschek
>
> InternalParquetRecordReader.close() currently throws a NullPointerException 
> if initialize() didn't succeed and hence the "reader" remains null. 
> This NPE happens with client usage idioms like this:
> {code}
> AvroParquetReader reader = ...
> try {
>        // read some parquet data
> } finally {
>   if (reader != null) { reader.close(); }
> }
> {code}
> I believe close() should read as follows:
> {code}
> public void close() throws IOException {
>     if (reader != null) {
>       reader.close();
>     }
>   }
> {code}
> Thoughts?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to