@InterfaceStability.Unstable
public class BigQueryOutputConfiguration
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static com.google.common.collect.ImmutableList<java.lang.String> |
REQUIRED_KEYS
A list of keys that are required for this output connector.
|
| Constructor and Description |
|---|
BigQueryOutputConfiguration() |
| Modifier and Type | Method and Description |
|---|---|
static void |
configure(org.apache.hadoop.conf.Configuration conf,
java.lang.String qualifiedOutputTableId,
BigQueryTableSchema outputTableSchema,
java.lang.String outputGcsPath,
BigQueryFileFormat outputFileFormat,
java.lang.Class<? extends org.apache.hadoop.mapreduce.lib.output.FileOutputFormat> outputFormatClass)
A helper function to set the required output keys in the given configuration.
|
static void |
configure(org.apache.hadoop.conf.Configuration conf,
java.lang.String qualifiedOutputTableId,
java.lang.String outputTableSchemaJson,
java.lang.String outputGcsPath,
BigQueryFileFormat outputFileFormat,
java.lang.Class<? extends org.apache.hadoop.mapreduce.lib.output.FileOutputFormat> outputFormatClass)
A helper function to set the required output keys in the given configuration.
|
static void |
configureWithAutoSchema(org.apache.hadoop.conf.Configuration conf,
java.lang.String qualifiedOutputTableId,
java.lang.String outputGcsPath,
BigQueryFileFormat outputFileFormat,
java.lang.Class<? extends org.apache.hadoop.mapreduce.lib.output.FileOutputFormat> outputFormatClass)
A helper function to set the required output keys in the given configuration.
|
static boolean |
getCleanupTemporaryDataFlag(org.apache.hadoop.conf.Configuration conf)
Gets if the configuration flag to cleanup temporary data in GCS is enabled or not.
|
static BigQueryFileFormat |
getFileFormat(org.apache.hadoop.conf.Configuration conf)
Gets the stored output
BigQueryFileFormat in the configuration. |
static org.apache.hadoop.mapreduce.lib.output.FileOutputFormat |
getFileOutputFormat(org.apache.hadoop.conf.Configuration conf)
Gets a configured instance of the stored
FileOutputFormat in the configuration. |
static org.apache.hadoop.fs.Path |
getGcsOutputPath(org.apache.hadoop.conf.Configuration conf)
Gets the stored GCS output path in the configuration.
|
static java.lang.String |
getKmsKeyName(org.apache.hadoop.conf.Configuration conf)
Gets the output table KMS key name based on the given configuration.
|
static java.lang.String |
getProjectId(org.apache.hadoop.conf.Configuration conf)
Gets the project id based on the given configuration.
|
static java.lang.String |
getWriteDisposition(org.apache.hadoop.conf.Configuration conf)
Gets the write disposition of the output table.
|
static void |
setKmsKeyName(org.apache.hadoop.conf.Configuration conf,
java.lang.String kmsKeyName) |
static void |
validateConfiguration(org.apache.hadoop.conf.Configuration conf)
Helper function that validates the output configuration.
|
public static final com.google.common.collect.ImmutableList<java.lang.String> REQUIRED_KEYS
public static void configure(org.apache.hadoop.conf.Configuration conf,
java.lang.String qualifiedOutputTableId,
java.lang.String outputTableSchemaJson,
java.lang.String outputGcsPath,
BigQueryFileFormat outputFileFormat,
java.lang.Class<? extends org.apache.hadoop.mapreduce.lib.output.FileOutputFormat> outputFormatClass)
throws java.io.IOException
conf - the configuration to set the keys on.qualifiedOutputTableId - the qualified id of the output table in the form: (Optional
ProjectId):[DatasetId].[TableId]. If the project id is missing, the default project
id is attempted BigQueryConfiguration.PROJECT_ID_KEY.outputTableSchemaJson - the schema of the BigQuery output table.outputGcsPath - the path in GCS to stage data in. Example: 'gs://bucket/job'.outputFileFormat - the formatting of the data being written by the output format class.outputFormatClass - the file output format that will write files to GCS.java.io.IOExceptionpublic static void configure(org.apache.hadoop.conf.Configuration conf,
java.lang.String qualifiedOutputTableId,
BigQueryTableSchema outputTableSchema,
java.lang.String outputGcsPath,
BigQueryFileFormat outputFileFormat,
java.lang.Class<? extends org.apache.hadoop.mapreduce.lib.output.FileOutputFormat> outputFormatClass)
throws java.io.IOException
conf - the configuration to set the keys on.qualifiedOutputTableId - the qualified id of the output table in the form: (Optional
ProjectId):[DatasetId].[TableId]. If the project id is missing, the default project
id is attempted BigQueryConfiguration.PROJECT_ID_KEY.outputTableSchema - the schema of the BigQuery output table. If the schema is null,
BigQuery will attempt to auto detect the schema. When using avro formatted data, a schema
is not required as avro stores the schema in the file.outputGcsPath - the path in GCS to stage data in. Example: 'gs://bucket/job'.outputFileFormat - the formatting of the data being written by the output format class.outputFormatClass - the file output format that will write files to GCS.java.io.IOExceptionpublic static void configureWithAutoSchema(org.apache.hadoop.conf.Configuration conf,
java.lang.String qualifiedOutputTableId,
java.lang.String outputGcsPath,
BigQueryFileFormat outputFileFormat,
java.lang.Class<? extends org.apache.hadoop.mapreduce.lib.output.FileOutputFormat> outputFormatClass)
throws java.io.IOException
This method will set the output table schema as auto-detected.
conf - the configuration to set the keys on.qualifiedOutputTableId - the qualified id of the output table in the form: (Optional
ProjectId):[DatasetId].[TableId]. If the project id is missing, the default project
id is attempted BigQueryConfiguration.PROJECT_ID_KEY.outputGcsPath - the path in GCS to stage data in. Example: 'gs://bucket/job'.outputFileFormat - the formatting of the data being written by the output format class.outputFormatClass - the file output format that will write files to GCS.java.io.IOExceptionpublic static void setKmsKeyName(org.apache.hadoop.conf.Configuration conf,
java.lang.String kmsKeyName)
public static void validateConfiguration(org.apache.hadoop.conf.Configuration conf)
throws java.io.IOException
conf - the configuration to validate.java.io.IOException - if the configuration is missing a key, or there's an issue while parsing
the schema in the configuration.public static boolean getCleanupTemporaryDataFlag(org.apache.hadoop.conf.Configuration conf)
conf - the configuration to reference the key from.public static java.lang.String getProjectId(org.apache.hadoop.conf.Configuration conf)
throws java.io.IOException
BigQueryConfiguration.OUTPUT_PROJECT_ID_KEY is missing, this resolves to referencing the
BigQueryConfiguration.PROJECT_ID_KEY key.conf - the configuration to reference the keys from.java.io.IOException - if a required key is missing.public static java.lang.String getKmsKeyName(org.apache.hadoop.conf.Configuration conf)
throws java.io.IOException
conf - the configuration to reference the keys from.java.io.IOExceptionpublic static BigQueryFileFormat getFileFormat(org.apache.hadoop.conf.Configuration conf) throws java.io.IOException
BigQueryFileFormat in the configuration.conf - the configuration to reference the keys from.BigQueryFileFormat in the configuration.java.io.IOException - if file format value is missing from the configuration.public static org.apache.hadoop.mapreduce.lib.output.FileOutputFormat getFileOutputFormat(org.apache.hadoop.conf.Configuration conf)
throws java.io.IOException
FileOutputFormat in the configuration.conf - the configuration to reference the keys from.FileOutputFormat in the configuration.java.io.IOException - if there's an issue getting an instance of a FileOutputFormat from the
configuration.public static org.apache.hadoop.fs.Path getGcsOutputPath(org.apache.hadoop.conf.Configuration conf)
throws java.io.IOException
conf - the configuration to reference the keys from.java.io.IOException - if the output path isn't set in the configuration, or the output path's
file system isn't derived from GoogleHadoopFileSystemBase.public static java.lang.String getWriteDisposition(org.apache.hadoop.conf.Configuration conf)
conf - the configuration to reference the keys from.Copyright © 2019. All rights reserved.