[
https://issues.apache.org/jira/browse/AVRO-2177?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Mahesh Mudi updated AVRO-2177:
--
Description:
Using avro-protobuf for google protobuf timestamp models fails to extract
schema due to invalid namespace resolution.
Proto model for timestamp has following options defined.
{code:java}
option java_outer_classname = "TimestampProto";
option java_multiple_files = true;
{code}
That would mean that the generated code for Timestamp will be at
"com.google.protobuf.Timestamp" rather than
"com.google.protobuf.TimestampProto$Timestamp".
However, when I try to derive an avro schema from a proto model using google
timestamp, avro-protobuf is not honouring the java_multiple_files option and
tries to look for timestamp class at
"com.google.protobuf.TimestampProto$Timestamp"
{code:java}
Caused by: java.lang.ClassNotFoundException: Failed to load
classcom.google.protobuf.TimestampProto$Timestamp
at org.apache.avro.util.ClassUtils.forName(ClassUtils.java:60)
at org.apache.avro.util.ClassUtils.forName(ClassUtils.java:36)
at org.apache.avro.protobuf.ProtobufData.newRecord(ProtobufData.java:137){code}
"getNamespace" of org.apache.avro.protobuf.ProtobufData ins't honouring
multiple files option there by breaking models that import google proto
definitions.
was:
Using avro-protobuf for google protobuf timestamp models fails to extract
schema due to invalid namespace resolution.
Proto model for timestamp has following options defined.
{code:java}
option java_outer_classname = "TimestampProto";
option java_multiple_files = true;
{code}
That would mean that the generated code for Timestamp will be at
"com.google.protobuf.Timestamp" rather than
"com.google.protobuf.TimestampProto$Timestamp".
However, when I try to derive an avro schema from a proto model using google
timestamp, avro-protobuf is not honouring the java_multiple_files option and
tries to look for timestamp class at
"com.google.protobuf.TimestampProto$Timestamp"
{code:java}
Caused by: java.lang.ClassNotFoundException: Failed to load
classcom.google.protobuf.TimestampProto$Timestamp
at org.apache.avro.util.ClassUtils.forName(ClassUtils.java:60)
at org.apache.avro.util.ClassUtils.forName(ClassUtils.java:36)
at
com.deliveroo.data.util.proto.avro.ProtobufData.newRecord(ProtobufData.java:137){code}
"getNamespace" of org.apache.avro.protobuf.ProtobufData ins't honouring
multiple files option there by breaking models that import google proto
definitions.
> avro-protobuf not honouring java_multiple_files option
> --
>
> Key: AVRO-2177
> URL: https://issues.apache.org/jira/browse/AVRO-2177
> Project: Avro
> Issue Type: Bug
> Components: java
>Affects Versions: 1.8.2
>Reporter: Mahesh Mudi
>Priority: Major
>
> Using avro-protobuf for google protobuf timestamp models fails to extract
> schema due to invalid namespace resolution.
>
> Proto model for timestamp has following options defined.
> {code:java}
> option java_outer_classname = "TimestampProto";
> option java_multiple_files = true;
> {code}
>
> That would mean that the generated code for Timestamp will be at
> "com.google.protobuf.Timestamp" rather than
> "com.google.protobuf.TimestampProto$Timestamp".
>
> However, when I try to derive an avro schema from a proto model using google
> timestamp, avro-protobuf is not honouring the java_multiple_files option and
> tries to look for timestamp class at
> "com.google.protobuf.TimestampProto$Timestamp"
>
> {code:java}
> Caused by: java.lang.ClassNotFoundException: Failed to load
> classcom.google.protobuf.TimestampProto$Timestamp
> at org.apache.avro.util.ClassUtils.forName(ClassUtils.java:60)
> at org.apache.avro.util.ClassUtils.forName(ClassUtils.java:36)
> at
> org.apache.avro.protobuf.ProtobufData.newRecord(ProtobufData.java:137){code}
>
> "getNamespace" of org.apache.avro.protobuf.ProtobufData ins't honouring
> multiple files option there by breaking models that import google proto
> definitions.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)