[
https://issues.apache.org/jira/browse/AVRO-1478?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13932200#comment-13932200
]
Doug Cutting commented on AVRO-1478:
------------------------------------
It would be simpler to have the C++ implementation observe Postel's law.
We need to map the schema name back to the protobuf generated class name. The
protobuf compiler for Java emits nested classes. Java nested classes are named
outer.package.Outer$Inner. Since all emitted protobuf records are inner
classes of a protocol, one might replace the final dollar with a dot. However
protobuf permits further nesting within a protocol, so it can generate class
names like outer.package.Outer$Inner$FurtherIn. To handle this without using
dollars we'd need to know the package of the enclosing protocol to know when to
stop substituting dots for dollars.
This could perhaps be included as a property in the schema, e.g.:
{"type":"record","namespace":"outer.package.Outer.Inner","name",FurtherIn,"protobuf.nesting":2"}
However fixing this would not enable you to read such data files from C++
without re-generating them.
Java Reflect has the same issue: it can currently generate Avro names that
contain a dollar sign.
Should we extend the spec to permit dollar sign in names, since they're out
there in the wild?
> protobuf namespaces causing problem for avro c++ reader
> -------------------------------------------------------
>
> Key: AVRO-1478
> URL: https://issues.apache.org/jira/browse/AVRO-1478
> Project: Avro
> Issue Type: Bug
> Reporter: George Baxter
>
> Utilizing the ProtobufData functionality to generate avro output, we run into
> a complication when consuming this output using the c++ based avro reader.
> Seems it doesn't much like the '$' of a nesting outer class that is inherent
> with protocol buffers in java.
> Exception opening file for read:Invalid namespace:
> com.xxx.base.message.MessageProtos$
> in
> avro::DataFileReader<avro::GenericDatum>* file_reader;
> file_reader = new
> avro::DataFileReader<avro::GenericDatum>(file_name.c_str());]
--
This message was sent by Atlassian JIRA
(v6.2#6252)