Class AvroGenericRecordToStorageApiProto
java.lang.Object
org.apache.beam.sdk.io.gcp.bigquery.AvroGenericRecordToStorageApiProto
Utility methods for converting Avro
GenericRecord objects to dynamic protocol message,
for use with the Storage write API.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic DynamicMessagemessageFromGenericRecord(Descriptors.Descriptor descriptor, GenericRecord record, String changeType, long changeSequenceNum) static DynamicMessagemessageFromGenericRecord(Descriptors.Descriptor descriptor, GenericRecord record, String changeType, String changeSequenceNum) Given an AvroGenericRecordobject, returns a protocol-buffer message that can be used to write data using the BigQuery Storage streaming API.static com.google.cloud.bigquery.storage.v1.TableSchemaprotoTableSchemaFromAvroSchema(Schema schema) Given an Avro Schema, returns a protocol-buffer TableSchema that can be used to write data through BigQuery Storage API.
-
Constructor Details
-
AvroGenericRecordToStorageApiProto
public AvroGenericRecordToStorageApiProto()
-
-
Method Details
-
protoTableSchemaFromAvroSchema
public static com.google.cloud.bigquery.storage.v1.TableSchema protoTableSchemaFromAvroSchema(Schema schema) Given an Avro Schema, returns a protocol-buffer TableSchema that can be used to write data through BigQuery Storage API.- Parameters:
schema- An Avro Schema- Returns:
- Returns the TableSchema created from the provided Schema
-
messageFromGenericRecord
public static DynamicMessage messageFromGenericRecord(Descriptors.Descriptor descriptor, GenericRecord record, @Nullable String changeType, long changeSequenceNum) -
messageFromGenericRecord
public static DynamicMessage messageFromGenericRecord(Descriptors.Descriptor descriptor, GenericRecord record, @Nullable String changeType, @Nullable String changeSequenceNum) Given an AvroGenericRecordobject, returns a protocol-buffer message that can be used to write data using the BigQuery Storage streaming API.- Parameters:
descriptor- The Descriptor for the DynamicMessage resultrecord- An Avro GenericRecord- Returns:
- A dynamic message representation of a Proto payload to be used for StorageWrite API
-