public PCollection expand()

in src/main/java/com/google/cloud/solutions/autotokenize/common/CsvIO.java [431:449]


    public PCollection<T> expand(PCollection<ReadableFile> input) {
      var csvFormat = CSVFormat.valueOf(csvFormatType());

      if (delimiter() != null) {
        csvFormat = csvFormat.withDelimiter(delimiter());
      }

      if (headers() != null) {
        csvFormat = csvFormat.withHeader(headers().toArray(new String[0]));
      }

      if (useFirstRowHeader()) {
        csvFormat = csvFormat.withFirstRecordAsHeader();
      }

      return input
          .apply("ReadCsvFile", ParDo.of(CsvFileReaderFn.create(fileCharset(), csvFormat)))
          .apply("Parse", MapElements.into(TypeDescriptors.outputOf(parseFn())).via(parseFn()));
    }