@Experimental(value=SCHEMAS) public class AvroUtils extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static java.lang.Object |
convertAvroFieldStrict(java.lang.Object value,
Schema avroSchema,
Schema.FieldType fieldType)
Strict conversion from AVRO to Beam, strict because it doesn't do widening or narrowing during
conversion.
|
static Schema.FieldType |
toFieldType(Schema avroSchema)
Converts AVRO schema to Beam field.
|
static Row |
toRowStrict(GenericRecord record,
Schema schema)
Strict conversion from AVRO to Beam, strict because it doesn't do widening or narrowing during
conversion.
|
static Schema |
toSchema(Schema schema)
Converts AVRO schema to Beam row schema.
|
public static Schema toSchema(@Nonnull Schema schema)
schema
- schema of type RECORDpublic static Schema.FieldType toFieldType(@Nonnull Schema avroSchema)
public static Row toRowStrict(@Nonnull GenericRecord record, @Nonnull Schema schema)
public static java.lang.Object convertAvroFieldStrict(@Nonnull java.lang.Object value, @Nonnull Schema avroSchema, @Nonnull Schema.FieldType fieldType)
value
- GenericRecord
or any nested valueavroSchema
- schema for valuefieldType
- target beam field typeRow