CSVSparkTransform { public BatchCSVRecord transform(BatchCSVRecord batch) { BatchCSVRecord batchCSVRecord = new BatchCSVRecord(); List<List<Writable>> converted = execute(toArrowWritables(toArrowColumnsString( bufferAllocator,transformProcess.getInitialSchema(), batch.getRecordsAsString()), transformProcess.getInitialSchema()),transformProcess); int numCols = converted.get(0).size(); for (int row = 0; row < converted.size(); row++) { String[] values = new String[numCols]; for (int i = 0; i < values.length; i++) values[i] = converted.get(row).get(i).toString(); batchCSVRecord.add(new SingleCSVRecord(values)); } return batchCSVRecord; }  Base64NDArrayBody toArray(BatchCSVRecord batch); Base64NDArrayBody toArray(SingleCSVRecord record); BatchCSVRecord transform(BatchCSVRecord batch); SingleCSVRecord transform(SingleCSVRecord record); SequenceBatchCSVRecord transformSequenceIncremental(BatchCSVRecord transform); SequenceBatchCSVRecord transformSequence(SequenceBatchCSVRecord batchCSVRecordSequence); Base64NDArrayBody transformSequenceArray(SequenceBatchCSVRecord batchCSVRecordSequence); Base64NDArrayBody transformSequenceArrayIncremental(BatchCSVRecord singleCsvRecord); SequenceBatchCSVRecord transform(SequenceBatchCSVRecord batchCSVRecord);  }
@Test public void testTransformerBatch() throws Exception { List<Writable> input = new ArrayList<>(); input.add(new DoubleWritable(1.0)); input.add(new DoubleWritable(2.0)); Schema schema = new Schema.Builder().addColumnDouble("1.0").addColumnDouble("2.0").build(); List<Writable> output = new ArrayList<>(); output.add(new Text("1.0")); output.add(new Text("2.0")); TransformProcess transformProcess = new TransformProcess.Builder(schema).convertToString("1.0").convertToString("2.0").build(); CSVSparkTransform csvSparkTransform = new CSVSparkTransform(transformProcess); String[] values = new String[] {"1.0", "2.0"}; SingleCSVRecord record = csvSparkTransform.transform(new SingleCSVRecord(values)); BatchCSVRecord batchCSVRecord = new BatchCSVRecord(); for (int i = 0; i < 3; i++) batchCSVRecord.add(record); BatchCSVRecord batchCSVRecord1 = csvSparkTransform.transform(batchCSVRecord); }