private List<Row> bqRowsToBeamRows( TableSchema bqSchema, List<TableRow> bqRows, Schema rowSchema) { if (bqRows == null) { return Collections.emptyList(); } return bqRows .stream() .map(bqRow -> toBeamRow(rowSchema, bqSchema, bqRow)) .collect(Collectors.toList()); }
@Override public Row apply(SchemaAndRecord input) { GenericRecord record = input.getRecord(); checkState( schema.getFields().size() == record.getSchema().getFields().size(), "Schema sizes are different."); return toBeamRow(record, schema); } }
@Override public PCollection<Row> buildIOReader(PBegin begin) { // TODO: make this more generic. return begin .apply(BigQueryIO.read(BigQueryUtils.toBeamRow(schema)).from(tableSpec)) .setRowSchema(getSchema()); }