Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
luigi-asprino committed Jun 23, 2023
1 parent 9d33dca commit 511b5fd
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ public Iterable<Slice> slice(Properties properties) throws IOException, Triplifi

CSVFormat format = buildFormat(properties);
Charset charset = Triplifier.getCharsetArgument(properties);

String dataSourceId = SPARQLAnythingConstants.DATA_SOURCE_ID; // there is always 1 data source id

// XXX How do we close the inputstream?
Expand All @@ -218,6 +217,7 @@ public Iterator<Slice> iterator() {
log.debug("Iterating slices");
return new Iterator<Slice>() {
int rown = 0;
int headersRowNumber = PropertyUtils.getIntegerProperty(properties, PROPERTY_HEADER_ROW);

@Override
public boolean hasNext() {
Expand All @@ -227,6 +227,12 @@ public boolean hasNext() {
@Override
public Slice next() {
rown++;
if(rown == headersRowNumber && !headers_map.isEmpty()){
// skip headers row
rown--;
headersRowNumber = -1; // this avoids that the condition is verified in the next iterations
recordIterator.next();
}
log.trace("next slice: {}", rown);
return CSVSlice.makeSlice(recordIterator.next(), rown, dataSourceId, headers_map);
}
Expand Down

0 comments on commit 511b5fd

Please sign in to comment.