GithubHelp home page GithubHelp logo

Comments (5)

nrwiersma avatar nrwiersma commented on June 10, 2024 1

Thanks for the contribution, it is released as part of v2.14.1

from avro.

Khalid-Nowaf avatar Khalid-Nowaf commented on June 10, 2024

I have looked at the code, and it seems it relies on the schema cache; if the type is not in the cache, the parser assumes the type definition is unknown. (and sometimes the type definition does exist, but it has not been cached yet)

I would see three approaches to fixing this issue:
1- a quick full schema scan cache the types
2- defer parsing any unknown type to the end, so the cache eventually will have the type definition if it does exist.
3- preprocess the schema by expanding any reference type so that each type would be populated with the exact definition.

from avro.

nrwiersma avatar nrwiersma commented on June 10, 2024

Hi,

I am reasonably certain the second case is not valid according to the spec. From my reading, name references must reference a previously defined name, meaning the definition for the name must be before the reference is used.

from avro.

Khalid-Nowaf avatar Khalid-Nowaf commented on June 10, 2024

@nrwiersma, thanks for a clear answer; you are correct; the definition must be defined first before using it, and now I just found the real issue in my code. Which is not related to ordering rather than naming. Here is an example of a schema that can be parsed in java avro-tool

{
    "name": "a.b.rootType",
    "type": "record",
    "fields": [
        {
            "name": "someEnum1",
            "type": {
                "name": "classEnum",
                "type": "enum",
                "symbols": [
                    "A",
                    "B",
                    "C"
                ]
            }
        },
        {
            "name": "someEnum2",
            "type": "a.b.classEnum"
        }
    ]
}

but when I used it with avrosv I got the following error
Error: avro: unknown type: a.b.classEnum

from avro.

nrwiersma avatar nrwiersma commented on June 10, 2024

That does seem like a bug.

from avro.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.