Search in sources :

Example 1 with WriteStream

use of com.google.cloud.bigquery.storage.v1.WriteStream in project beam by apache.

the class FakeDatasetService method createWriteStream.

@Override
public WriteStream createWriteStream(String tableUrn, Type type) throws IOException, InterruptedException {
    TableReference tableReference = BigQueryHelpers.parseTableUrn(BigQueryHelpers.stripPartitionDecorator(tableUrn));
    synchronized (tables) {
        TableContainer tableContainer = getTableContainer(tableReference.getProjectId(), tableReference.getDatasetId(), tableReference.getTableId());
        String streamName = UUID.randomUUID().toString();
        writeStreams.put(streamName, new Stream(streamName, tableContainer, type));
        return WriteStream.newBuilder().setName(streamName).build();
    }
}
Also used : TableReference(com.google.api.services.bigquery.model.TableReference) WriteStream(com.google.cloud.bigquery.storage.v1.WriteStream) ByteString(com.google.protobuf.ByteString) FormatString(com.google.errorprone.annotations.FormatString)

Aggregations

TableReference (com.google.api.services.bigquery.model.TableReference)1 WriteStream (com.google.cloud.bigquery.storage.v1.WriteStream)1 FormatString (com.google.errorprone.annotations.FormatString)1 ByteString (com.google.protobuf.ByteString)1