@Internal public class FakeDatasetService extends java.lang.Object implements BigQueryServices.DatasetService, java.io.Serializable
Constructor and Description |
---|
FakeDatasetService() |
Modifier and Type | Method and Description |
---|---|
void |
close() |
com.google.api.core.ApiFuture<com.google.cloud.bigquery.storage.v1beta2.BatchCommitWriteStreamsResponse> |
commitWriteStreams(java.lang.String tableUrn,
java.lang.Iterable<java.lang.String> writeStreamNames)
Commit write streams of type PENDING.
|
void |
createDataset(java.lang.String projectId,
java.lang.String datasetId,
java.lang.String location,
java.lang.String description,
java.lang.Long defaultTableExpirationMs)
Create a
Dataset with the given location , description and default
expiration time for tables in the dataset (if null , tables don't expire). |
void |
createTable(Table table)
Creates the specified table if it does not exist.
|
com.google.cloud.bigquery.storage.v1beta2.WriteStream |
createWriteStream(java.lang.String tableUrn,
com.google.cloud.bigquery.storage.v1beta2.WriteStream.Type type)
Create a Write Stream for use with the Storage Write API.
|
void |
deleteDataset(java.lang.String projectId,
java.lang.String datasetId)
Deletes the dataset specified by the datasetId value.
|
void |
deleteTable(TableReference tableRef)
Deletes the table specified by tableId from the dataset.
|
void |
failOnInsert(java.util.Map<TableRow,java.util.List<TableDataInsertAllResponse.InsertErrors>> insertErrors)
Cause a given
TableRow object to fail when it's inserted. |
com.google.api.core.ApiFuture<com.google.cloud.bigquery.storage.v1beta2.FinalizeWriteStreamResponse> |
finalizeWriteStream(java.lang.String streamName)
Finalize a write stream.
|
com.google.api.core.ApiFuture<com.google.cloud.bigquery.storage.v1beta2.FlushRowsResponse> |
flush(java.lang.String streamName,
long offset)
Flush a given stream up to the given offset.
|
java.util.List<java.lang.String> |
getAllIds(java.lang.String projectId,
java.lang.String datasetId,
java.lang.String tableId) |
java.util.List<TableRow> |
getAllRows(java.lang.String projectId,
java.lang.String datasetId,
java.lang.String tableId) |
Dataset |
getDataset(java.lang.String projectId,
java.lang.String datasetId)
Gets the specified
Dataset resource by dataset ID. |
int |
getInsertCount() |
BigQueryServices.StreamAppendClient |
getStreamAppendClient(java.lang.String streamName,
Descriptors.Descriptor descriptor)
Create an append client for a given Storage API write stream.
|
Table |
getTable(TableReference tableRef)
Gets the specified
Table resource by table ID. |
Table |
getTable(TableReference tableRef,
java.util.List<java.lang.String> selectedFields) |
<T> long |
insertAll(TableReference ref,
java.util.List<FailsafeValueInSingleWindow<TableRow,TableRow>> rowList,
java.util.List<java.lang.String> insertIdList,
InsertRetryPolicy retryPolicy,
java.util.List<ValueInSingleWindow<T>> failedInserts,
ErrorContainer<T> errorContainer,
boolean skipInvalidRows,
boolean ignoreUnknownValues,
boolean ignoreInsertIds,
java.util.List<ValueInSingleWindow<TableRow>> successfulRows)
Inserts
TableRows with the specified insertIds if not null. |
long |
insertAll(TableReference ref,
java.util.List<TableRow> rowList,
java.util.List<java.lang.String> insertIdList) |
boolean |
isTableEmpty(TableReference tableRef)
Returns true if the table is empty.
|
Table |
patchTableDescription(TableReference tableReference,
java.lang.String tableDescription)
Patch BigQuery
Table description. |
static void |
setUp() |
public void close() throws java.lang.Exception
close
in interface java.lang.AutoCloseable
java.lang.Exception
public static void setUp()
public Table getTable(TableReference tableRef) throws java.lang.InterruptedException, java.io.IOException
BigQueryServices.DatasetService
Table
resource by table ID.
Returns null if the table is not found.
getTable
in interface BigQueryServices.DatasetService
java.lang.InterruptedException
java.io.IOException
public Table getTable(TableReference tableRef, @Nullable java.util.List<java.lang.String> selectedFields) throws java.lang.InterruptedException, java.io.IOException
getTable
in interface BigQueryServices.DatasetService
java.lang.InterruptedException
java.io.IOException
public java.util.List<TableRow> getAllRows(java.lang.String projectId, java.lang.String datasetId, java.lang.String tableId) throws java.lang.InterruptedException, java.io.IOException
java.lang.InterruptedException
java.io.IOException
public java.util.List<java.lang.String> getAllIds(java.lang.String projectId, java.lang.String datasetId, java.lang.String tableId) throws java.lang.InterruptedException, java.io.IOException
java.lang.InterruptedException
java.io.IOException
public void deleteTable(TableReference tableRef) throws java.io.IOException, java.lang.InterruptedException
BigQueryServices.DatasetService
deleteTable
in interface BigQueryServices.DatasetService
java.io.IOException
java.lang.InterruptedException
public void createTable(Table table) throws java.io.IOException
BigQueryServices.DatasetService
createTable
in interface BigQueryServices.DatasetService
java.io.IOException
public boolean isTableEmpty(TableReference tableRef) throws java.io.IOException, java.lang.InterruptedException
BigQueryServices.DatasetService
isTableEmpty
in interface BigQueryServices.DatasetService
java.io.IOException
- if the table is not found.java.lang.InterruptedException
public Dataset getDataset(java.lang.String projectId, java.lang.String datasetId) throws java.io.IOException, java.lang.InterruptedException
BigQueryServices.DatasetService
Dataset
resource by dataset ID.getDataset
in interface BigQueryServices.DatasetService
java.io.IOException
java.lang.InterruptedException
public void createDataset(java.lang.String projectId, java.lang.String datasetId, java.lang.String location, java.lang.String description, java.lang.Long defaultTableExpirationMs) throws java.io.IOException, java.lang.InterruptedException
BigQueryServices.DatasetService
Dataset
with the given location
, description
and default
expiration time for tables in the dataset (if null
, tables don't expire).createDataset
in interface BigQueryServices.DatasetService
java.io.IOException
java.lang.InterruptedException
public void deleteDataset(java.lang.String projectId, java.lang.String datasetId) throws java.io.IOException, java.lang.InterruptedException
BigQueryServices.DatasetService
Before you can delete a dataset, you must delete all its tables.
deleteDataset
in interface BigQueryServices.DatasetService
java.io.IOException
java.lang.InterruptedException
public int getInsertCount()
public long insertAll(TableReference ref, java.util.List<TableRow> rowList, @Nullable java.util.List<java.lang.String> insertIdList) throws java.io.IOException, java.lang.InterruptedException
java.io.IOException
java.lang.InterruptedException
public <T> long insertAll(TableReference ref, java.util.List<FailsafeValueInSingleWindow<TableRow,TableRow>> rowList, @Nullable java.util.List<java.lang.String> insertIdList, InsertRetryPolicy retryPolicy, java.util.List<ValueInSingleWindow<T>> failedInserts, ErrorContainer<T> errorContainer, boolean skipInvalidRows, boolean ignoreUnknownValues, boolean ignoreInsertIds, java.util.List<ValueInSingleWindow<TableRow>> successfulRows) throws java.io.IOException, java.lang.InterruptedException
BigQueryServices.DatasetService
TableRows
with the specified insertIds if not null.
If any insert fail permanently according to the retry policy, those rows are added to failedInserts.
Returns the total bytes count of TableRows
.
insertAll
in interface BigQueryServices.DatasetService
java.io.IOException
java.lang.InterruptedException
public Table patchTableDescription(TableReference tableReference, @Nullable java.lang.String tableDescription) throws java.io.IOException, java.lang.InterruptedException
BigQueryServices.DatasetService
Table
description.patchTableDescription
in interface BigQueryServices.DatasetService
java.io.IOException
java.lang.InterruptedException
public com.google.cloud.bigquery.storage.v1beta2.WriteStream createWriteStream(java.lang.String tableUrn, com.google.cloud.bigquery.storage.v1beta2.WriteStream.Type type) throws java.io.IOException, java.lang.InterruptedException
BigQueryServices.DatasetService
createWriteStream
in interface BigQueryServices.DatasetService
java.io.IOException
java.lang.InterruptedException
public BigQueryServices.StreamAppendClient getStreamAppendClient(java.lang.String streamName, Descriptors.Descriptor descriptor)
BigQueryServices.DatasetService
getStreamAppendClient
in interface BigQueryServices.DatasetService
public com.google.api.core.ApiFuture<com.google.cloud.bigquery.storage.v1beta2.FlushRowsResponse> flush(java.lang.String streamName, long offset)
BigQueryServices.DatasetService
flush
in interface BigQueryServices.DatasetService
public com.google.api.core.ApiFuture<com.google.cloud.bigquery.storage.v1beta2.FinalizeWriteStreamResponse> finalizeWriteStream(java.lang.String streamName)
BigQueryServices.DatasetService
finalizeWriteStream
in interface BigQueryServices.DatasetService
public com.google.api.core.ApiFuture<com.google.cloud.bigquery.storage.v1beta2.BatchCommitWriteStreamsResponse> commitWriteStreams(java.lang.String tableUrn, java.lang.Iterable<java.lang.String> writeStreamNames)
BigQueryServices.DatasetService
commitWriteStreams
in interface BigQueryServices.DatasetService
public void failOnInsert(java.util.Map<TableRow,java.util.List<TableDataInsertAllResponse.InsertErrors>> insertErrors)
TableRow
object to fail when it's inserted. The errors link the list will
be returned on subsequent retries, and the insert will succeed when the errors run out.