Skip to content

Commit

Permalink
Refactored CSV header handling and column mapping logic
Browse files Browse the repository at this point in the history
This commit includes implementing integer conversion for index mapping in CsvFile.php, which improves the header mapping logic. Furthermore, the header specification 'csv: header: false' has been removed from various test yaml files, implying a shift towards handling CSV files with headers. The changes collectively lead to a considerably streamlined CSV data processing workflow.
  • Loading branch information
SmetDenis committed Mar 30, 2024
1 parent 2027c76 commit de579ee
Show file tree
Hide file tree
Showing 11 changed files with 1 addition and 30 deletions.
1 change: 1 addition & 0 deletions src/Csv/CsvFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ public function getColumnsMappedByHeader(): array

$realHeader = $this->getHeader();
foreach ($realHeader as $realIndex => $realColumn) {
$realIndex = (int)$realIndex;
$schemaColumn = $this->schema->getColumn($realColumn);

if ($schemaColumn !== null) {
Expand Down
3 changes: 0 additions & 3 deletions tests/Benchmarks/bench_0_quickest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@

filename_pattern: /.csv$/i

csv:
header: false

columns:
- rules:
not_empty: true
3 changes: 0 additions & 3 deletions tests/Benchmarks/bench_0_quickest_agg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@

filename_pattern: /.csv$/i

csv:
header: false

columns:
- aggregate_rules:
count: 0
3 changes: 0 additions & 3 deletions tests/Benchmarks/bench_0_quickest_combo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@

filename_pattern: /.csv$/i

csv:
header: false

columns:
- rules:
not_empty: true
Expand Down
3 changes: 0 additions & 3 deletions tests/Benchmarks/bench_1_mini.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@

filename_pattern: /.csv$/i

csv:
header: false

columns:
- rules:
not_empty: true
Expand Down
3 changes: 0 additions & 3 deletions tests/Benchmarks/bench_1_mini_agg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@

filename_pattern: /.csv$/i

csv:
header: false

columns:
- aggregate_rules:
average: 0
Expand Down
3 changes: 0 additions & 3 deletions tests/Benchmarks/bench_1_mini_combo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@

filename_pattern: /.csv$/i

csv:
header: false

columns:
- rules:
not_empty: true
Expand Down
3 changes: 0 additions & 3 deletions tests/Benchmarks/bench_2_realistic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@

filename_pattern: /.csv$/i

csv:
header: false

columns:
- rules:
not_empty: true
Expand Down
3 changes: 0 additions & 3 deletions tests/Benchmarks/bench_2_realistic_agg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@

filename_pattern: /.csv$/i

csv:
header: false

columns:
- aggregate_rules:
is_unique: true
Expand Down
3 changes: 0 additions & 3 deletions tests/Benchmarks/bench_2_realistic_combo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@

filename_pattern: /.csv$/i

csv:
header: false

columns:
- rules:
not_empty: true
Expand Down
3 changes: 0 additions & 3 deletions tests/Benchmarks/bench_3_all_agg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@

filename_pattern: /.csv$/i

csv:
header: false

columns:
- rules:
not_empty: true
Expand Down

0 comments on commit de579ee

Please sign in to comment.