[ML] Fix find_file_structure NPE with should_trim_fields (#35465)
The NPE would occur if should_trim_field was overridden to true and any field value was completely blank. This change defends against this situation. Fixes #35462
This commit is contained in:
parent
a18b599d64
commit
09965cb370
|
@ -82,7 +82,7 @@ public class DelimitedFileStructureFinder implements FileStructureFinder {
|
|||
int lineNumber = lineNumbers.get(index);
|
||||
Map<String, String> sampleRecord = new LinkedHashMap<>();
|
||||
Util.filterListToMap(sampleRecord, columnNames,
|
||||
trimFields ? row.stream().map(String::trim).collect(Collectors.toList()) : row);
|
||||
trimFields ? row.stream().map(field -> (field == null) ? null : field.trim()).collect(Collectors.toList()) : row);
|
||||
sampleRecords.add(sampleRecord);
|
||||
sampleMessages.add(
|
||||
sampleLines.subList(prevMessageEndLineNumber + 1, lineNumbers.get(index)).stream().collect(Collectors.joining("\n")));
|
||||
|
|
Loading…
Reference in New Issue