swaminathanmanish commented on code in PR #12220:
URL: https://github.com/apache/pinot/pull/12220#discussion_r1446869846
##########
pinot-core/src/main/java/org/apache/pinot/core/segment/processing/mapper/SegmentMapper.java:
##########
@@ -141,28 +146,43 @@ private Map<String, GenericRowFileManager> doMap()
RecordReaderFactory.getRecordReader(recordReaderFileConfig._fileFormat,
recordReaderFileConfig._dataFile,
recordReaderFileConfig._fieldsToRead,
recordReaderFileConfig._recordReaderConfig);
mapAndTransformRow(recordReader, reuse, observer, count, totalCount);
+ _recordReaderFileConfigs.get(i)._recordReader = recordReader;
} finally {
- if (recordReader != null) {
+ if (recordReader != null && !recordReader.hasNext()) {
Review Comment:
How about we keep all the allocation/close logic within
RecordReaderConfigClass?
1) We can introduce a method getRecordReader(), that returns the
RecordReader (its a delegate if the user passes the reader directly) or creates
one using the factory.
2) We can expose close() method, that closes the reader only if its not
delegate.
3) We can keep track of inited/closed state and expose apis (isInited or
isClosed) that can be used to determine if the reader has to be processed.
Basically callers use the methods getReader(), close(), isClosed(),
isInited() to determine whether to pick it up or not.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]