public class ProtoByteUtils
extends java.lang.Object
Users can utilize the methods in this class to facilitate the integration of Proto data processing within Apache Beam pipelines, allowing for the seamless transformation of Proto messages to Beam Rows and vice versa.
Constructor and Description |
---|
ProtoByteUtils() |
Modifier and Type | Method and Description |
---|---|
static Schema |
getBeamSchemaFromProto(java.lang.String fileDescriptorPath,
java.lang.String messageName)
Retrieves a Beam Schema from a Protocol Buffer message.
|
static Schema |
getBeamSchemaFromProtoSchema(java.lang.String schemaString,
java.lang.String messageName)
Parses the given Protocol Buffers schema string, retrieves the Descriptor for the specified
message name, and constructs a Beam Schema from it.
|
static SerializableFunction<byte[],Row> |
getProtoBytesToRowFromSchemaFunction(java.lang.String schemaString,
java.lang.String messageName) |
static SerializableFunction<byte[],Row> |
getProtoBytesToRowFunction(java.lang.String fileDescriptorPath,
java.lang.String messageName) |
static SerializableFunction<Row,byte[]> |
getRowToProtoBytes(java.lang.String fileDescriptorPath,
java.lang.String messageName) |
static SerializableFunction<Row,byte[]> |
getRowToProtoBytesFromSchema(java.lang.String schemaString,
java.lang.String messageName) |
public static Schema getBeamSchemaFromProto(java.lang.String fileDescriptorPath, java.lang.String messageName)
fileDescriptorPath
- The path to the File Descriptor Set file.messageName
- The name of the Protocol Buffer message.public static Schema getBeamSchemaFromProtoSchema(java.lang.String schemaString, java.lang.String messageName)
schemaString
- The Protocol Buffers schema string.messageName
- The name of the message type for which the Beam Schema is desired.java.lang.RuntimeException
- If there is an error during parsing, descriptor retrieval, or schema
construction.public static SerializableFunction<byte[],Row> getProtoBytesToRowFromSchemaFunction(java.lang.String schemaString, java.lang.String messageName)
public static SerializableFunction<byte[],Row> getProtoBytesToRowFunction(java.lang.String fileDescriptorPath, java.lang.String messageName)
public static SerializableFunction<Row,byte[]> getRowToProtoBytesFromSchema(java.lang.String schemaString, java.lang.String messageName)
public static SerializableFunction<Row,byte[]> getRowToProtoBytes(java.lang.String fileDescriptorPath, java.lang.String messageName)