Skip to content

Commit

Permalink
Use header_names instead of column_N if available
Browse files Browse the repository at this point in the history
  • Loading branch information
kylecbrodie committed Jul 11, 2020
1 parent 7ec9293 commit aa169ef
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,12 @@ public UnivocityFileReader(FileSystem fs, Path filePath, Map<String, Object> con
super(fs, filePath, new UnivocityToStruct(), config);

this.iterator = iterateRecords();
this.schema = buildSchema(this.iterator, settings.isHeaderExtractionEnabled(), config);
Boolean hasHeader = settings.isHeaderExtractionEnabled();
if (!hasHeader) {
String[] headers = settings.getHeaders();
hasHeader = headers != null && headers.length > 0;
}
this.schema = buildSchema(this.iterator, hasHeader, config);
}

private Schema buildSchema(ResultIterator<Record, ParsingContext> it, boolean hasHeader, Map<String, Object> config) {
Expand Down

0 comments on commit aa169ef

Please sign in to comment.