You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Kirill Marchuk (Jira)" <ji...@apache.org> on 2022/07/29 10:32:00 UTC

[jira] [Comment Edited] (AVRO-1977) Arrays of Imported Types in Schema Definition

    [ https://issues.apache.org/jira/browse/AVRO-1977?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17572913#comment-17572913 ] 

Kirill Marchuk edited comment on AVRO-1977 at 7/29/22 10:31 AM:
----------------------------------------------------------------

Hi [~ddukek22] I am curious, why has this PR been closed? I am trying to find a way to refer to existing (defined as Java type, not via AVRO) type for array items and can't seem to find a way :()

 

{
{color:#9876aa}"type"{color}{color:#cc7832}: {color}{color:#6a8759}"array"{color}{color:#cc7832},{color}{color:#cc7832} {color}{color:#9876aa}"items"{color}{color:#cc7832}: {color}{
{color:#9876aa}"type"{color}{color:#cc7832}: {color}{color:#6a8759}"com.something.MethodType"{color}{color:#6a8759} \{color}},{color}{color:#cc7832} {color}{color:#9876aa}"java-class"{color}{color:#cc7832}: {color}{color:#6a8759}"java.util.List"
 }{color}

{color:#6a8759}}



leads to ".avsc: Type not supported: com.something.MethodType"

 

whereas using

{
"type"{color}{color:#cc7832}: {color}{color:#6a8759}"array"{color}{color:#cc7832},{color}{color:#cc7832} {color}{color:#9876aa}"items"{color}{color:#cc7832}: {color}{color:#6a8759}"com.something.MethodType"{color}{color:#cc7832},{color}{color:#cc7832} {color}{color:#9876aa}"java-class"{color}{color:#cc7832}: {color}"java.util.List"
}}

 

leads to 'avsc: Undefined name: "com.something.MethodType"'


was (Author: JIRAUSER293614):
Hi [~ddukek22] I am curious, why has this PR been closed? I am trying to find a way to refer to existing (defined as Java type, not via AVRO) type for array items and can't seem to find a way :()

 

{
{color:#9876aa}"type"{color}{color:#cc7832}: {color}{color:#6a8759}"array"{color}{color:#cc7832},
{color}{color:#cc7832} {color}{color:#9876aa}"items"{color}{color:#cc7832}: {color}{
{color:#9876aa}"type"{color}{color:#cc7832}: {color}{color:#6a8759}"com.something.MethodType"
{color}{color:#6a8759} {color}}{color:#cc7832},
{color}{color:#cc7832} {color}{color:#9876aa}"java-class"{color}{color:#cc7832}: {color}{color:#6a8759}"java.util.List"
{color}}



leads to ".avsc: Type not supported: com.something.MethodType"

 

whereas using

{
{color:#9876aa}"type"{color}{color:#cc7832}: {color}{color:#6a8759}"array"{color}{color:#cc7832},
{color}{color:#cc7832} {color}{color:#9876aa}"items"{color}{color:#cc7832}: {color}{color:#6a8759}"com.something.MethodType"{color}{color:#cc7832},
{color}{color:#cc7832} {color}{color:#9876aa}"java-class"{color}{color:#cc7832}: {color}{color:#6a8759}"java.util.List"
{color}}

 

leads to 'avsc: Undefined name: "com.something.MethodType"'

> Arrays of Imported Types in Schema Definition
> ---------------------------------------------
>
>                 Key: AVRO-1977
>                 URL: https://issues.apache.org/jira/browse/AVRO-1977
>             Project: Apache Avro
>          Issue Type: Improvement
>          Components: java
>    Affects Versions: 1.8.1
>            Reporter: Dillon Dukek
>            Priority: Minor
>             Fix For: 1.8.1
>
>
> Using the maven-plugin we can specify a list of schemas for import which can then be used as dependencies in subsequent schemas. However, this does not work if we want to use an imported type as the item type of an array field in a record. This currently does not work due to the way that the items node of the array field is passed back to the parse method in Schema.java here https://github.com/apache/avro/blob/master/lang/java/avro/src/main/java/org/apache/avro/Schema.java#L1306. The imported type will only be found if the type within the items node is passed to parse as it is for example here https://github.com/apache/avro/blob/master/lang/java/avro/src/main/java/org/apache/avro/Schema.java#L1306 for the union type.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)