Search in sources :

Example 1 with BigQueryClient

use of com.google.cloud.spark.bigquery.repackaged.com.google.cloud.bigquery.connector.common.BigQueryClient in project OpenLineage by OpenLineage.

the class MockBigQueryRelationProvider method createRelationInternal.

@Override
public BigQueryRelation createRelationInternal(SQLContext sqlContext, Map<String, String> parameters, Option<StructType> schema) {
    Injector injector = INJECTOR.createGuiceInjector(sqlContext, parameters, schema);
    SparkBigQueryConfig config = injector.getInstance(SparkBigQueryConfig.class);
    BigQueryClient bigQueryClient = injector.getInstance(BigQueryClient.class);
    TableInfo tableInfo = bigQueryClient.getReadTable(config.toReadTableOptions());
    Dataset<Row> testRecords = injector.getInstance(new Key<Dataset<Row>>() {
    });
    return new MockBigQueryRelation(config, tableInfo, sqlContext, testRecords);
}
Also used : SparkBigQueryConfig(com.google.cloud.spark.bigquery.SparkBigQueryConfig) BigQueryClient(com.google.cloud.spark.bigquery.repackaged.com.google.cloud.bigquery.connector.common.BigQueryClient) Injector(com.google.cloud.spark.bigquery.repackaged.com.google.inject.Injector) Dataset(org.apache.spark.sql.Dataset) Row(org.apache.spark.sql.Row)

Aggregations

SparkBigQueryConfig (com.google.cloud.spark.bigquery.SparkBigQueryConfig)1 BigQueryClient (com.google.cloud.spark.bigquery.repackaged.com.google.cloud.bigquery.connector.common.BigQueryClient)1 Injector (com.google.cloud.spark.bigquery.repackaged.com.google.inject.Injector)1 Dataset (org.apache.spark.sql.Dataset)1 Row (org.apache.spark.sql.Row)1