@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 |
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.
|
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. |
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. |
Table |
getTable(TableReference tableRef)
Gets the specified
Table resource by table ID. |
Table |
getTable(TableReference tableRef,
@Nullable java.util.List<java.lang.String> selectedFields) |
<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)
Inserts
TableRows with the specified insertIds if not null. |
long |
insertAll(TableReference ref,
java.util.List<TableRow> rowList,
@Nullable java.util.List<java.lang.String> insertIdList) |
boolean |
isTableEmpty(TableReference tableRef)
Returns true if the table is empty.
|
Table |
patchTableDescription(TableReference tableReference,
@Nullable java.lang.String tableDescription)
Patch BigQuery
Table description. |
static void |
setUp() |
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 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) 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 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.