mayankshriv commented on a change in pull request #6466: URL: https://github.com/apache/incubator-pinot/pull/6466#discussion_r561174145
########## File path: pinot-core/src/main/java/org/apache/pinot/core/data/readers/PinotSegmentRecordReader.java ########## @@ -81,25 +81,29 @@ public PinotSegmentRecordReader(File indexDir, @Nullable Schema schema, @Nullabl _schema = new SegmentMetadataImpl(indexDir).getSchema(); Collection<String> columnNames = _schema.getColumnNames(); _columnReaderMap = new HashMap<>(columnNames.size()); - for (String columnName : columnNames) { - _columnReaderMap.put(columnName, new PinotSegmentColumnReader(_immutableSegment, columnName)); + if (_numDocs > 0) { Review comment: Instead of sprinkling `if (_numDocs > 0)`, can we branch out for `(if _numDocs == 0)` early on and handle empty segment separately? ---------------------------------------------------------------- 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: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org