in sdk/src/main/java/com/google/cloud/dataflow/sdk/io/BigQueryIO.java [396:427]
public void validate(PInput input) {
if (table == null && query == null) {
throw new IllegalStateException(
"Invalid BigQuery read operation, either table reference or query has to be set");
} else if (table != null && query != null) {
throw new IllegalStateException("Invalid BigQuery read operation. Specifies both a"
+ " query and a table, only one of these should be provided");
}
BigQueryOptions bqOptions = input.getPipeline().getOptions().as(BigQueryOptions.class);
if (table != null && table.getProjectId() == null) {
// If user does not specify a project we assume the table to be located in the project
// that owns the Dataflow job.
LOG.warn(String.format(SET_PROJECT_FROM_OPTIONS_WARNING, table.getDatasetId(),
table.getTableId(), bqOptions.getProject()));
table.setProjectId(bqOptions.getProject());
}
if (validate) {
// Check for source table/query presence for early failure notification.
// Note that a presence check can fail if the table or dataset are created by earlier
// stages of the pipeline or if a query depends on earlier stages of a pipeline. For these
// cases the withoutValidation method can be used to disable the check.
if (table != null) {
verifyDatasetPresence(bqOptions, table);
verifyTablePresence(bqOptions, table);
}
if (query != null) {
dryRunQuery(bqOptions, query);
}
}
}