K - Key type.V - Value type (must be JsonObject or a derived type).public class BigQueryRecordWriter<K,V extends com.google.gson.JsonObject>
extends org.apache.hadoop.mapreduce.RecordWriter<K,V>
| Modifier and Type | Class and Description |
|---|---|
static class |
BigQueryRecordWriter.Counter
Defines names of counters we track for each operation.
|
| Constructor and Description |
|---|
BigQueryRecordWriter(BigQueryFactory factory,
java.util.concurrent.ExecutorService threadPool,
ClientRequestHelper<com.google.api.services.bigquery.model.Job> clientRequestHelper,
org.apache.hadoop.conf.Configuration configuration,
org.apache.hadoop.util.Progressable progressable,
java.lang.String taskIdentifier,
java.util.List<com.google.api.services.bigquery.model.TableFieldSchema> outputRecordSchema,
java.lang.String projectId,
com.google.api.services.bigquery.model.TableReference tableRef,
int writeBufferSize)
Constructs an instance of BigQueryRecordWriter that writes to the table with ID tableId in the
dataset denoted by datasetId under the project denoted by projectId.
|
BigQueryRecordWriter(org.apache.hadoop.conf.Configuration configuration,
org.apache.hadoop.util.Progressable progressable,
java.lang.String taskIdentifier,
java.util.List<com.google.api.services.bigquery.model.TableFieldSchema> outputRecordSchema,
java.lang.String projectId,
com.google.api.services.bigquery.model.TableReference tableRef,
int writeBufferSize)
Constructs an instance of BigQueryRecordWriter that writes to the table with ID tableId in the
dataset denoted by datasetId under the project denoted by projectId.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close(org.apache.hadoop.mapreduce.TaskAttemptContext context)
Closes this RecordWriter to future operations.
|
static java.lang.String |
countersToString()
Gets value of all counters as a formatted string.
|
long |
getBytesWritten()
Returns the total number of bytes written so far.
|
void |
write(K key,
V value)
Writes a key/value pair.
|
public BigQueryRecordWriter(BigQueryFactory factory, java.util.concurrent.ExecutorService threadPool, ClientRequestHelper<com.google.api.services.bigquery.model.Job> clientRequestHelper, org.apache.hadoop.conf.Configuration configuration, org.apache.hadoop.util.Progressable progressable, java.lang.String taskIdentifier, java.util.List<com.google.api.services.bigquery.model.TableFieldSchema> outputRecordSchema, java.lang.String projectId, com.google.api.services.bigquery.model.TableReference tableRef, int writeBufferSize) throws java.io.IOException
outputRecordSchema - the schema describing the output records.projectId - the id of the project under which to perform the BigQuery operations.tableRef - the fully qualified reference to the (temp) table to write to; its projectId
must be specified, and may or may not match the projectId which owns the BigQuery job.writeBufferSize - The size of the upload buffer to use.java.io.IOException - on IOError.public BigQueryRecordWriter(org.apache.hadoop.conf.Configuration configuration,
org.apache.hadoop.util.Progressable progressable,
java.lang.String taskIdentifier,
java.util.List<com.google.api.services.bigquery.model.TableFieldSchema> outputRecordSchema,
java.lang.String projectId,
com.google.api.services.bigquery.model.TableReference tableRef,
int writeBufferSize)
throws java.io.IOException
configuration - Configuration for the job / taskprogressable - Progressable to which we should report statustaskIdentifier - A String to help identify actions performed by this RecordWriter,
for example, a TaskAttemptID. Not required to be unique, but must match "[a-zA-Z0-9-_]+".outputRecordSchema - the schema describing the output records.projectId - the id of the project.tableRef - the fully qualified reference to the (temp) table to write to; its projectId
must be specified, and may or may not match the projectId which owns the BigQuery job.writeBufferSize - The size of the upload buffer to use.java.io.IOException - on IOError.public void close(org.apache.hadoop.mapreduce.TaskAttemptContext context)
throws java.io.IOException
public long getBytesWritten()
public static java.lang.String countersToString()
Copyright © 2019. All rights reserved.