Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
i am producing the data and consuming it too
using same avro schema
look like my issue is similar to what Tim Chan had - com.twitter.bijection.InversionFailure: Failed to invert: [B@44e0a074
P. Oscar Boykin
failure to invert happens anytime the data is not what you expect.
it may, or may not, be his issue.
his issue looks like avro did not think that his Foo class was a Specific avro class.
step 1, you can in a test generate random objects, serialize and then deserialize them.
get kafka out of the picture
when you are sure the injection is working correctly, you can figure out what is going on with kafka
ok let me try that, thx
that worked
val schema: Schema = new Schema.Parser().parse(scala.io.Source.fromInputStream(getClass.getResourceAsStream(firmLegacySecurityAvroSchemaFile)).mkString)
val recordInjection: Injection[GenericRecord, Array[Byte]] = GenericAvroCodecs.toBinary(schema)

val record = new GenericData.Record(schema)
record.put("id", firmLegacySecurity.id)
record.put("masterSecID", firmLegacySecurity.masterSecID)
record.put("positionID", firmLegacySecurity.positionID)
record.put("dateAdded", firmLegacySecurity.dateAdded.toString)
record.put("dateModified", if(firmLegacySecurity.dateModified != null) firmLegacySecurity.dateModified.toString else "")

val bytes: Array[Byte] = recordInjection.apply(record)

val record1: GenericRecord = recordInjection.invert(bytes).get
val id = record1.get("id").toString
val masterSecId = record1.get("masterSecID").toString
val positionId = record1.get("positionID").toString
P. Oscar Boykin
so, that suggests that something about kafka is the issue
dang, now what could that be :), Thanks for your help
P. Oscar Boykin
Good luck!
Hi, does anyone have example of serialization/deserialization of nested avro schema using bijection?
something like this gives error -
record.put("legacy.MasterSecID", firmLegacySecurity.masterSecID)
Hey guys
is it possible to convert from a GenericRecord to a case class
hey guys still me i have an avro GenericRecord and i want to map it to a case class is this possible or do i need to do it manually
Hi guys, how easy/clean is using bijection in java to convert between json <-> byte[]
I looked for docs, but there aren't much
Martijn Hoekstra
should array2Traversable allow or disallow sharing changes to the underlying array? Or is it more of a "if you do that, who knows what might happen" kind of thing?