Skip to content

InternalParquetRecordReader.close() should not throw an exception if initialization has failed #1695

@asfimport

Description

@asfimport

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:

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

I believe close() should read as follows:

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

Thoughts?

Reporter: Wolfgang Hoschek / @whoschek
Assignee: Wolfgang Hoschek / @whoschek

Note: This issue was originally created as PARQUET-145. Please see the migration documentation for further details.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions