[
https://issues.apache.org/jira/browse/AVRO-2498?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16947027#comment-16947027
]
Ryan Skraba commented on AVRO-2498:
-----------------------------------
[~raj2019] For the moment, it looks like specific records generated with
avro-tools have never treated UUIDs as anything other than strings.
I think there are two potential bugs or issues here:
1) There's no warning or error when the logical type annotation is ignored
(when generating a specific record).
I don't think this is a bug or bad behaviour: the spec says to fall back on the
underlying type if it's otherwise inconsistent. A warning during schema
compilation might be a good idea.
N.B. There was a simple typo in [~igreene]'s code, but his comment was correct
– the type should be {{string}}, not {{long}} or {{text}}
{code:java}
{"type": "record", "name": "Avro2498",
"fields": [
{"name": "myField", "type": {"type": "string", "logicalType": "uuid"}}
]
}
{code}
2) Unlike decimal or date/time logical types, the specific compiler *never*
generates fields of type {{java.util.UUID}}.
This might be an interesting new feature to be more consistent with the decimal
and date/time types built into the SpecificCompiler, especially now that UUID
has made its appearance in the spec in Avro 1.9.
Is there any strong push to implement a UUID type in generated records? Should
we repurpose this JIRA to provide some extra dev feedback when a logical type
annotation is ignored by the specific compiler or maven plugin?
> UUID generation is not working avro 1.9 version
> -----------------------------------------------
>
> Key: AVRO-2498
> URL: https://issues.apache.org/jira/browse/AVRO-2498
> Project: Apache Avro
> Issue Type: Bug
> Reporter: Raj G
> Priority: Major
>
> Hi,
>
> I've downloaded avro-tools 1.9 jar and trying to generate a java file from an
> avro schema using below command
>
> java -jar avro-tools-1.9.0.jar compile schema ./myschema.avsc ./avro_java
>
> and have below schema in my .avsc file to generate a UUID field
> {
> "name": "myField",
> "type": {
> "type": "long",
> "logicalType": "uuid"
> }
> }
>
> But this is generating a long field instead of UUID type. Please suggest.
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)