use of org.apache.beam.sdk.annotations.Experimental in project beam by apache.
the class BigQueryQuerySourceDef method getBeamSchema.
/**
* {@inheritDoc}
*/
@Experimental(Kind.SCHEMAS)
@Override
public Schema getBeamSchema(BigQueryOptions bqOptions) {
try {
JobStatistics stats = BigQueryQueryHelper.dryRunQueryIfNeeded(bqServices, bqOptions, dryRunJobStats, query.get(), flattenResults, useLegacySql, location);
TableSchema tableSchema = stats.getQuery().getSchema();
return BigQueryUtils.fromTableSchema(tableSchema);
} catch (IOException | InterruptedException | NullPointerException e) {
throw new BigQuerySchemaRetrievalException("Exception while trying to retrieve schema of query", e);
}
}
use of org.apache.beam.sdk.annotations.Experimental in project beam by apache.
the class BigQueryTableSourceDef method getBeamSchema.
/**
* {@inheritDoc}
*/
@Experimental(Kind.SCHEMAS)
@Override
public Schema getBeamSchema(BigQueryOptions bqOptions) {
try {
TableReference tableRef = getTableReference(bqOptions);
TableSchema tableSchema = bqServices.getDatasetService(bqOptions).getTable(tableRef).getSchema();
return BigQueryUtils.fromTableSchema(tableSchema);
} catch (IOException | InterruptedException | NullPointerException e) {
throw new BigQuerySchemaRetrievalException("Exception while trying to retrieve schema", e);
}
}
Aggregations