Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
### What changes were proposed in this pull request? This PR aims to fix NPE in TestFlinkOrcReaderWriter. ```java @OverRide public void close() throws IOException { if (!isClosed) { try { if (batch.size > 0) { writer.addRowBatch(batch); batch.reset(); } } finally { writer.close(); this.isClosed = true; } } } ``` writer.addRowBatch(batch); ```java ....... checkMemory(); } catch (Throwable t) { try { close(); } catch (Throwable ignore) { // ignore } if (t instanceof IOException) { throw (IOException) t; } else { throw new IOException("Problem adding row to " + path, t); } } ``` addRowBatch method throws java.lang.OutOfMemoryError causing writerImpl to close twice in TestFlinkOrcReaderWriter case. The first close already set the rawWriter to null, so the second time throw a NullPointerException. I added status variables to ensure that close will only do the necessary action the first time. ### Why are the changes needed? Fix NPE in TestFlinkOrcReaderWriter. ### How was this patch tested? Add UT for this bug.
- Loading branch information