public abstract class CsvIOParse<T> extends PTransform<PCollection<java.lang.String>,CsvIOParseResult<T>>
PTransform
for Parsing CSV Record Strings into Schema
-mapped target types. CsvIOParse
is not instantiated directly but via CsvIO.parse(java.lang.Class<T>, org.apache.commons.csv.CSVFormat)
or CsvIO.parseRows(org.apache.beam.sdk.schemas.Schema, org.apache.commons.csv.CSVFormat)
.annotations, displayData, name, resourceHints
Constructor and Description |
---|
CsvIOParse() |
Modifier and Type | Method and Description |
---|---|
CsvIOParseResult<T> |
expand(PCollection<java.lang.String> input)
Override this method to specify how this
PTransform should be expanded on the given
InputT . |
<OutputT> CsvIOParse<T> |
withCustomRecordParsing(java.lang.String fieldName,
SerializableFunction<java.lang.String,OutputT> customRecordParsingFn)
Configures custom cell parsing.
|
addAnnotation, compose, compose, getAdditionalInputs, getAnnotations, getDefaultOutputCoder, getDefaultOutputCoder, getDefaultOutputCoder, getKindString, getName, getResourceHints, populateDisplayData, setDisplayData, setResourceHints, toString, validate, validate
public <OutputT> CsvIOParse<T> withCustomRecordParsing(java.lang.String fieldName, SerializableFunction<java.lang.String,OutputT> customRecordParsingFn)
CsvIO.parse().withCustomRecordParsing("listOfInts", cell-> {
List<Integer> result = new ArrayList<>();
for (String stringValue: Splitter.on(";").split(cell)) {
result.add(Integer.parseInt(stringValue));
}
});
public CsvIOParseResult<T> expand(PCollection<java.lang.String> input)
PTransform
PTransform
should be expanded on the given
InputT
.
NOTE: This method should not be called directly. Instead apply the PTransform
should
be applied to the InputT
using the apply
method.
Composite transforms, which are defined in terms of other transforms, should return the output of one of the composed transforms. Non-composite transforms, which do not apply any transforms internally, should return a new unbound output and register evaluators (via backend-specific registration methods).
expand
in class PTransform<PCollection<java.lang.String>,CsvIOParseResult<T>>