[
https://issues.apache.org/jira/browse/AVRO-2108?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17930854#comment-17930854
]
ASF subversion and git services commented on AVRO-2108:
-------------------------------------------------------
Commit fe0261deecf22234bbd09251764152d4bf9a9c4a in avro's branch
refs/heads/dependabot/maven/lang/java/org.apache.thrift-libthrift-0.21.0 from
Sarthak Singh
[ https://gitbox.apache.org/repos/asf?p=avro.git;h=fe0261dee ]
AVRO-2108: [Java] DoubleArray converts double to float (#3285)
* fixing DoubleArray float cast
* add new line
* preventing boxing
---------
Co-authored-by: Martin Grigorov <[email protected]>
> @Stringable annotation should be processed before creating the schema
> ---------------------------------------------------------------------
>
> Key: AVRO-2108
> URL: https://issues.apache.org/jira/browse/AVRO-2108
> Project: Apache Avro
> Issue Type: Bug
> Components: java
> Affects Versions: 1.8.2
> Reporter: Faisal Feroz
> Priority: Major
> Labels: pull-request-available
> Time Spent: 1.5h
> Remaining Estimate: 0h
>
> In {{org.apache.avro.reflect.ReflectData::createFieldSchema}} the following
> code is processing Stringable after explicitly creating a schema
> {code:java}
> Schema schema = createSchema(field.getGenericType(), names);
> if (field.isAnnotationPresent(Stringable.class)) { // Stringable
> schema = Schema.create(Schema.Type.STRING);
> }
> {code}
> https://github.com/apache/avro/blob/3af404efb31a1dc2fd720384ef9a3f7326c2d303/lang/java/avro/src/main/java/org/apache/avro/reflect/ReflectData.java#L748
> The above code has a side effect when @Stringable annotation is placed over a
> Generic Type like {{ID}} which results in Unknown Type {{ID}} since the
> schema is created first which causes the error.
> Changing the code to following would fix this. Also it would also act as a
> micro optimization of the code as the generated schema is overwritten if
> stringable annotation is preset
> {code:java}
> Schema schema = null;
> if (field.isAnnotationPresent(Stringable.class)) { // Stringable
> schema = Schema.create(Schema.Type.STRING);
> } else {
> schema = createSchema(field.getGenericType(), names);
> }
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)