Berkeley Avro Plugin 2.10

97 views
Skip to first unread message

Vitaly Gordon

unread,
Feb 5, 2014, 10:48:41 PM2/5/14
to scoobi...@googlegroups.com
Hi Eric,
I've been trying to use your 2.10 port to the plugin, and though I managed to compile and package it, I cannot seem to use it.
Here is the error I am getting

[INFO]   last tree to typer: This(class MemberPositionClusterSimilarity)
[INFO]               symbol: class MemberPositionClusterSimilarity in package avatar (flags: case)
[INFO]    symbol definition: case class MemberPositionClusterSimilarity extends SpecificRecordBase with HasAvroConversions with AvroRecord with Product with Serializable
[INFO]                  tpe: MemberPositionClusterSimilarity.this.type
[INFO]        symbol owners: class MemberPositionClusterSimilarity -> package avatar
[INFO]       context owners: method get -> class MemberPositionClusterSimilarity -> package avatar
[INFO] 
[INFO] == Enclosing template or block ==
[INFO] 
[INFO] CaseDef(
[INFO]   2
[INFO]   TypeApply( // final def asInstanceOf[T0]: T0 in class Any
[INFO]     MemberPositionClusterSimilarity.this.convert[String, org.apache.avro.util.Utf8](null, MemberPositionClusterSimilarity.this.title)."asInstanceOf" // final def asInstanceOf[T0]: T0 in class Any
[INFO]     <tpt> // tree.tpe=Object
[INFO]   )
[INFO] )

I was also getting this error with bunch of other classes (like Option[Int] -> Integer).

Thanks,
Vitaly

Eric Torreborre

unread,
Feb 6, 2014, 11:40:51 PM2/6/14
to scoobi...@googlegroups.com
Hi Vitaly,

That's bad. I'm not sure how I can help with that because that's pretty low level Scala-compiler hackery.

Maybe you can start investigating something like that: https://github.com/GenslerAppsPod/scalavro which is more of a runtime library?

Otherwise the other approach would be to use macros to create the AvroSchema.

Unfortunately I don't have time to investigate any of this at the moment :-(.

Eric.

Julian Peeters

unread,
Jun 1, 2014, 2:53:25 AM6/1/14
to scoobi...@googlegroups.com
Hello,

The compiler plugin stumped me, but I had some time to port the essentials for making case classes serializable over to a macro annotation: avro-scala-macro-annotations.

However I'm having trouble testing it with scoobi: 
1) the latest `scoobi/examples/avro` fails to download the a transitive dependency ` org.scala-tools#vscaladoc;1.1-md-3!vscaladoc.jar`
2) I can't seem to find a version of the avro compiler plugin for 2.9.2 (I found some other examples that presumably worked at some point). 
3) I don't really follow how the tests seem to use case classes that do not extend AvroRecord, and are serialized with xmap instead.
4) Reading an Avro file with macro-annotated class (or any authentic code-gen'd class that implements SpecificRecord) results in this error that I don't understand: 
ambiguous implicit values:
[error]  both method AvroFmt in trait LowPriorityWireFormatImplicits of type [T <: org.apache.avro.specific.SpecificRecordBase](implicit evidence$4: Manifest[T], implicit evidence$5: com.nicta.scoobi.io.avro.AvroSchema[T])com.nicta.scoobi.Scoobi.AvroWireFormat[T]
[error]  and method GenericAvroFmt in trait LowPriorityWireFormatImplicits of type [T <: org.apache.avro.generic.GenericRecord]=> com.nicta.scoobi.Scoobi.GenericAvroWireFormat[T]
[error]  match expected type com.nicta.scoobi.core.WireFormat[com.miguno.avro.twitter_schema]
[error]     val searches = fromAvroFile[com.miguno.avro.twitter_schema](path)

Any tips on how people are reading and writing avros with scoobi in Scala 2.10+ would be very appreciated.

Thanks,
Julian 
Reply all
Reply to author
Forward
0 new messages