public class BigQueryUtils
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
BigQueryUtils.ConversionOptions
Options for how to convert BigQuery data to Beam data.
|
Constructor and Description |
---|
BigQueryUtils() |
Modifier and Type | Method and Description |
---|---|
static java.lang.Object |
convertAvroFormat(Schema.FieldType beamFieldType,
java.lang.Object avroValue,
BigQueryUtils.ConversionOptions options)
Tries to convert an Avro decoded value to a Beam field value based on the target type of the
Beam field.
|
static Schema |
fromTableSchema(TableSchema tableSchema)
Convert a BigQuery
TableSchema to a Beam Schema . |
static org.apache.beam.sdk.io.gcp.bigquery.BigQueryIO.TypedRead.FromBeamRowFunction<TableRow> |
tableRowFromBeamRow() |
static org.apache.beam.sdk.io.gcp.bigquery.BigQueryIO.TypedRead.ToBeamRowFunction<TableRow> |
tableRowToBeamRow() |
static Row |
toBeamRow(GenericRecord record,
Schema schema,
BigQueryUtils.ConversionOptions options) |
static Row |
toBeamRow(Schema rowSchema,
TableRow jsonBqRow)
|
static Row |
toBeamRow(Schema rowSchema,
TableSchema bqSchema,
TableRow jsonBqRow)
Tries to parse the JSON
TableRow from BigQuery. |
static Schema |
toGenericAvroSchema(java.lang.String schemaName,
java.util.List<TableFieldSchema> fieldSchemas)
Convert a list of BigQuery
TableFieldSchema to Avro Schema . |
static SerializableFunction<Row,TableRow> |
toTableRow()
|
static TableRow |
toTableRow(Row row)
Convert a BigQuery TableRow to a Beam Row.
|
static <T> SerializableFunction<T,TableRow> |
toTableRow(SerializableFunction<T,Row> toRow)
Convert a Beam schema type to a BigQuery
TableRow . |
static TableSchema |
toTableSchema(Schema schema)
Convert a Beam
Schema to a BigQuery TableSchema . |
public static TableSchema toTableSchema(Schema schema)
Schema
to a BigQuery TableSchema
.public static Schema fromTableSchema(TableSchema tableSchema)
TableSchema
to a Beam Schema
.public static Schema toGenericAvroSchema(java.lang.String schemaName, java.util.List<TableFieldSchema> fieldSchemas)
TableFieldSchema
to Avro Schema
.public static final org.apache.beam.sdk.io.gcp.bigquery.BigQueryIO.TypedRead.ToBeamRowFunction<TableRow> tableRowToBeamRow()
public static final org.apache.beam.sdk.io.gcp.bigquery.BigQueryIO.TypedRead.FromBeamRowFunction<TableRow> tableRowFromBeamRow()
public static SerializableFunction<Row,TableRow> toTableRow()
public static <T> SerializableFunction<T,TableRow> toTableRow(SerializableFunction<T,Row> toRow)
TableRow
.public static Row toBeamRow(GenericRecord record, Schema schema, BigQueryUtils.ConversionOptions options)
public static Row toBeamRow(Schema rowSchema, TableSchema bqSchema, TableRow jsonBqRow)
TableRow
from BigQuery.
Only supports basic types and arrays. Doesn't support date types.
public static java.lang.Object convertAvroFormat(Schema.FieldType beamFieldType, java.lang.Object avroValue, BigQueryUtils.ConversionOptions options)