Skip to content

Fix CSVReaderBase validation, split, timestamp, and progress bugs#3771

Draft
arthurianresolve wants to merge 4 commits into
NationalSecurityAgency:integrationfrom
arthurianresolve:bugfix/CSVReaderBase
Draft

Fix CSVReaderBase validation, split, timestamp, and progress bugs#3771
arthurianresolve wants to merge 4 commits into
NationalSecurityAgency:integrationfrom
arthurianresolve:bugfix/CSVReaderBase

Conversation

@arthurianresolve

@arthurianresolve arthurianresolve commented Jul 25, 2026

Copy link
Copy Markdown

Summary

  • detect required CSV fields that are missing entirely from name=value input
  • only skip the CSV header row on the first file split
  • use the raw input file modification time as the default event timestamp
  • return stable progress for empty or zero-length CSV splits
  • add focused CSVReaderBase and CSVRecordReader regression coverage

Fixes Bug (CSVReaderBase) - missing required fields are not detected in name-value mode #3767.
Fixes Bug (CSVReaderBase) - skip header row skips data on non-first splits #3772.
Fixes Bug (CSVReaderBase) - default event timestamp uses ingest time #3773.
Fixes Bug (CSVReaderBase) - progress can be invalid for zero-length splits #3774.

Implementation commits

Root cause and impact

CSVReaderBase.checkField(...) only checked required fields when a field was present and processed. In name=value mode, a required field that was absent from the input never reached checkField(...), so no MISSING_DATA_ERROR was added. The fix tracks field names processed for each event, compares them with the configured required fields, and reports any required field that was not present. Existing empty-value validation remains in checkField(...).

CSVReaderBase.nextKeyValue() skipped a row whenever the reader-local counter was 0 and skipHeaderRow was enabled. On a later FileSplit, that counter also starts at 0, so the first data row assigned to that split could be dropped. The fix records whether the split starts at byte 0 and only applies header skipping to the first split.

CSVReaderBase.initialize(...) set the default event timestamp from System.currentTimeMillis(). That made events without configured event-date fields depend on ingest time instead of the source file timestamp already captured by LongLineEventRecordReader. The fix uses the raw input file timestamp when available and only falls back to current time if no file timestamp is present.

CSVReaderBase.getProgress() divided by totalSize without handling zero or empty splits. That could produce invalid progress values. The fix returns 0f for zero-size splits and keeps the existing upper bound of 1f for normal splits.

Test

mvn --batch-mode --errors --no-transfer-progress -Dmaven.build.cache.enabled=false -pl warehouse/ingest-csv -am -Dtest=CSVReaderBaseTest,CSVRecordReaderRequiredFieldsTest,ExtendedCSVHelperTest,NormalizedContentInterfaceTest -Dsurefire.failIfNoSpecifiedTests=false -DskipITs -DskipFormat test

Result: BUILD SUCCESS across 25 reactor projects in 49.251 s.

  • CSVReaderBaseTest: 3 tests, 0 failures, 0 errors, 0 skipped
  • CSVRecordReaderRequiredFieldsTest: 2 tests, 0 failures, 0 errors, 0 skipped
  • ExtendedCSVHelperTest: 1 test, 0 failures, 0 errors, 0 skipped
  • NormalizedContentInterfaceTest: 3 tests, 0 failures, 0 errors, 0 skipped
  • Total selected tests: 9 tests, 0 failures, 0 errors, 0 skipped
  • Checkstyle: 0 violations in changed modules
  • git diff --check origin/integration..HEAD: passes

@arthurianresolve arthurianresolve changed the title Fix CSVReaderBase required field validation Fix CSVReaderBase validation, split, timestamp, and progress bugs Jul 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant