suddendust commented on a change in pull request #7237:
URL: https://github.com/apache/pinot/pull/7237#discussion_r690900454



##########
File path: 
pinot-plugins/pinot-input-format/pinot-csv/src/main/java/org/apache/pinot/plugin/inputformat/csv/CSVRecordReader.java
##########
@@ -103,6 +105,23 @@ public void init(File dataFile, @Nullable Set<String> 
fieldsToRead, @Nullable Re
     _recordExtractor.init(fieldsToRead, recordExtractorConfig);
   }
 
+  private void validateHeaderForDelimiter(char delimiter, String csvHeader, 
CSVFormat format)
+      throws IOException {
+    CSVParser parser = 
format.parse(RecordReaderUtils.getBufferedReader(_dataFile));
+    CSVRecord firstRecord = parser.getRecords().get(0);
+    if (recordHasMultipleValues(firstRecord) && 
delimiterNotPresentInHeader(delimiter, csvHeader)) {

Review comment:
       Yes, this is much more efficient. `getRecords` is reading the entire 
file. Addressed.




-- 
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: commits-unsubscr...@pinot.apache.org

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

Reply via email to