apache / apache/datafusion

support `skip_rows` for `CsvFormat`

Open
#8,824 13 comments 1 reaction 0 assignees View on GitHub
enhancement
Dominant language
Rust
Stars
9.3k
Forks
2.4k
Avg merge
3d 7h
Merged PRs (30d)
344

Description

### Is your feature request related to a problem or challenge?

Some tools generate CSVs that contain some extra data at the top or bottom, such as bank statement exports

```csv
"Account Name : REDACTED"
"Account Number : REDACTED"
"Date Range : 01/01/2023-12/31/2023"
Transaction Date,Posted Date,Category,Debit
2023-01-01,2023-01-01,Payment/Credit,100.0
```

I'd like a way to skip the first `n` rows

### Describe the solution you'd like

add a new option to `CsvFormat` for skipping rows

```rust
CsvFormat::default().with_skip_rows(2)
```

### Describe alternatives you've considered

none that I can think of.

### Additional context

https://github.com/GlareDB/glaredb/issues/2035

Contributor guide

Open the contributing guide

Research direction

Start by locating CsvFormat and the existing CSV reader tests or entry points. Review how CsvFormat options are applied during CSV ingestion, then add coverage for the requested skip_rows behavior, including the example with leading metadata. Done means CsvFormat::default().with_skip_rows(2) skips the first two rows when reading a CSV.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
data-engineering
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.