public class AvroBulletRecordConverter extends BulletRecordConverter
String
as its
string type.
TypedAvroBulletRecord
or
UntypedAvroBulletRecord
.Modifier and Type | Field and Description |
---|---|
protected boolean |
runStringFixer |
config, schema, shouldTypeCheck
Constructor and Description |
---|
AvroBulletRecordConverter()
Constructs an AvroBulletRecordConverter without a schema.
|
AvroBulletRecordConverter(com.yahoo.bullet.common.BulletConfig bulletConfig)
Constructs an AvroBulletRecordConverter from a given configuration.
|
AvroBulletRecordConverter(String schema)
Constructs an AvroBulletRecordConverter from a given schema.
|
Modifier and Type | Method and Description |
---|---|
protected BulletRecordConverter |
build()
Helper function used to initialize BulletRecordConverter from BulletDSLConfig.
|
com.yahoo.bullet.record.BulletRecord |
convert(Object object,
com.yahoo.bullet.record.BulletRecord record)
Converts an object to a BulletRecord using the given record.
|
protected com.yahoo.bullet.record.BulletRecord |
convertGenericRecord(org.apache.avro.generic.GenericRecord genericRecord,
org.apache.avro.Schema schema,
com.yahoo.bullet.record.BulletRecord record)
Converts a
GenericRecord with a Schema into the provided BulletRecord . |
protected Object |
get(Object object,
String base)
Gets the specified top-level field from the object.
|
protected Object |
getField(Object object,
String field)
Gets the specified inner field from the object.
|
protected void |
setField(BulletRecordField field,
Object value,
com.yahoo.bullet.record.BulletRecord record)
Sets the field in a
BulletRecord . |
convert, flattenMap, from, getTypedObject
public AvroBulletRecordConverter() throws BulletDSLException
BulletDSLException
- if there is an error creating the converter.public AvroBulletRecordConverter(String schema) throws BulletDSLException
schema
- A schema file that specifies the fields to extract and their types.BulletDSLException
- if there is an error creating the converter.public AvroBulletRecordConverter(com.yahoo.bullet.common.BulletConfig bulletConfig) throws BulletDSLException
bulletConfig
- The configuration that specifies the settings for an AvroBulletRecordConverter.BulletDSLException
- if there is an error creating the converter.protected BulletRecordConverter build() throws BulletDSLException
BulletRecordConverter
BulletRecordProvider
, and optionally the BulletRecordSchema
, used by the converter.build
in class BulletRecordConverter
BulletDSLException
- if there is an error creating the converter.public com.yahoo.bullet.record.BulletRecord convert(Object object, com.yahoo.bullet.record.BulletRecord record) throws BulletDSLException
BulletRecordConverter
convert
in class BulletRecordConverter
object
- The object to be converted.record
- The record to insert fields into.BulletDSLException
- if there is an error converting the object to a BulletRecord.protected com.yahoo.bullet.record.BulletRecord convertGenericRecord(org.apache.avro.generic.GenericRecord genericRecord, org.apache.avro.Schema schema, com.yahoo.bullet.record.BulletRecord record)
GenericRecord
with a Schema
into the provided BulletRecord
.genericRecord
- The GenericRecord
to convert.schema
- The Schema
of the GenericRecord
.record
- The BulletRecord
to place the fields into.BulletRecord
with the added fields.protected void setField(BulletRecordField field, Object value, com.yahoo.bullet.record.BulletRecord record)
BulletRecordConverter
BulletRecord
.setField
in class BulletRecordConverter
field
- The field to set.value
- The value to set the field to.record
- The record to set the field in.protected Object get(Object object, String base)
BulletRecordConverter
get
in class BulletRecordConverter
object
- The object to get from.base
- The top-level field to get.protected Object getField(Object object, String field)
BulletRecordConverter
getField
in class BulletRecordConverter
object
- The object to get from.field
- The inner field to get.Copyright © 2021. All rights reserved.