This question evaluates a candidate's ability to implement CSV-style dataset joins, exercising skills in string parsing, sorting, join semantics (left join behavior and multiple matches), and handling edge cases in data processing.
Implement joinDataSet(fieldName, customerFile, processorFile, skipUnmatched).
You are given two datasets represented as List<String>, where:
customerFile[0]
is the header row for the customer dataset.
processorFile[0]
is the header row for the processor dataset.
Inputs:
fieldName: String
— the column name used as the join key.
customerFile: List<String>
processorFile: List<String>
skipUnmatched: boolean
Return a new List<String> representing the joined dataset:
Requirements:
fieldName
exists in both headers.
fieldName
before joining.
customerFile
to
processorFile
using
fieldName
.
skipUnmatched == false
, include the customer row and fill the processor-side columns with empty strings;
skipUnmatched == true
, omit that customer row entirely.
In short, this problem evolves through four stages:
fieldName
skipUnmatched
is
true
Write the function that produces the joined CSV-style dataset.