@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)
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.AutoCloseablejava.lang.Exceptionpublic static void setUp()
public Table getTable(TableReference tableRef) throws java.lang.InterruptedException, java.io.IOException
BigQueryServices.DatasetServiceTable resource by table ID.
Returns null if the table is not found.
getTable in interface BigQueryServices.DatasetServicejava.lang.InterruptedExceptionjava.io.IOExceptionpublic Table getTable(TableReference tableRef, @Nullable java.util.List<java.lang.String> selectedFields) throws java.lang.InterruptedException, java.io.IOException
getTable in interface BigQueryServices.DatasetServicejava.lang.InterruptedExceptionjava.io.IOExceptionpublic 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.InterruptedExceptionjava.io.IOExceptionpublic 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.InterruptedExceptionjava.io.IOExceptionpublic void deleteTable(TableReference tableRef) throws java.io.IOException, java.lang.InterruptedException
BigQueryServices.DatasetServicedeleteTable in interface BigQueryServices.DatasetServicejava.io.IOExceptionjava.lang.InterruptedExceptionpublic void createTable(Table table) throws java.io.IOException
BigQueryServices.DatasetServicecreateTable in interface BigQueryServices.DatasetServicejava.io.IOExceptionpublic boolean isTableEmpty(TableReference tableRef) throws java.io.IOException, java.lang.InterruptedException
BigQueryServices.DatasetServiceisTableEmpty in interface BigQueryServices.DatasetServicejava.io.IOException - if the table is not found.java.lang.InterruptedExceptionpublic Dataset getDataset(java.lang.String projectId, java.lang.String datasetId) throws java.io.IOException, java.lang.InterruptedException
BigQueryServices.DatasetServiceDataset resource by dataset ID.getDataset in interface BigQueryServices.DatasetServicejava.io.IOExceptionjava.lang.InterruptedExceptionpublic 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.DatasetServiceDataset with the given location, description and default
expiration time for tables in the dataset (if null, tables don't expire).createDataset in interface BigQueryServices.DatasetServicejava.io.IOExceptionjava.lang.InterruptedExceptionpublic void deleteDataset(java.lang.String projectId,
java.lang.String datasetId)
throws java.io.IOException,
java.lang.InterruptedException
BigQueryServices.DatasetServiceBefore you can delete a dataset, you must delete all its tables.
deleteDataset in interface BigQueryServices.DatasetServicejava.io.IOExceptionjava.lang.InterruptedExceptionpublic 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.IOExceptionjava.lang.InterruptedExceptionpublic <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) throws java.io.IOException, java.lang.InterruptedException
BigQueryServices.DatasetServiceTableRows 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.DatasetServicejava.io.IOExceptionjava.lang.InterruptedExceptionpublic Table patchTableDescription(TableReference tableReference, @Nullable java.lang.String tableDescription) throws java.io.IOException, java.lang.InterruptedException
BigQueryServices.DatasetServiceTable description.patchTableDescription in interface BigQueryServices.DatasetServicejava.io.IOExceptionjava.lang.InterruptedExceptionpublic 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.DatasetServicecreateWriteStream in interface BigQueryServices.DatasetServicejava.io.IOExceptionjava.lang.InterruptedExceptionpublic BigQueryServices.StreamAppendClient getStreamAppendClient(java.lang.String streamName, Descriptors.Descriptor descriptor)
BigQueryServices.DatasetServicegetStreamAppendClient in interface BigQueryServices.DatasetServicepublic com.google.api.core.ApiFuture<com.google.cloud.bigquery.storage.v1beta2.FlushRowsResponse> flush(java.lang.String streamName,
long offset)
BigQueryServices.DatasetServiceflush in interface BigQueryServices.DatasetServicepublic com.google.api.core.ApiFuture<com.google.cloud.bigquery.storage.v1beta2.FinalizeWriteStreamResponse> finalizeWriteStream(java.lang.String streamName)
BigQueryServices.DatasetServicefinalizeWriteStream in interface BigQueryServices.DatasetServicepublic 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.DatasetServicecommitWriteStreams in interface BigQueryServices.DatasetServicepublic 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.