Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CanonicalSchema and SchemaCRC64Avro fail to inline sub-schemas referenced by name #138

Open
joshng opened this issue Nov 1, 2018 · 2 comments
Labels

Comments

@joshng
Copy link

joshng commented Nov 1, 2018

If the type of a record field, array, or map-value refers to a previously-declared type by name (eg, "type": "com.example.MyEmbeddedType"), then the structure used to compute the schemaCanonical string (and thus the schema fingerprint) should embed the fully-specified sub-schema, rather than just the type name.

The current implementation fails to dereference the named schema, resulting in incorrect canonicalization and fingerprinting.

I can follow up later with a concrete example, and I'm working on a fix which I will hopefully submit for review soon.

@karrick karrick added the bug label Jun 21, 2019
@przemekd
Copy link

przemekd commented Aug 2, 2019

On top of that, logical types are not properly processed. I've added my test and got:

--- FAIL: TestCanonicalSchema (0.00s)
    canonical_test.go:267: Test failed for schema: {"type":"record","name":"test","namespace":"com.linkedin.avro","fields":[{"name":"astring","type":"string"},{"name":"acomplextype","type":{"type":"long","logicalType":"timestamp-millis"}},{"name":"arecord",  "type":{"type":"record","name":"innerRecord","fields":[{"name":"value","type":"long"}]}}]}
                got canonical:          {"name":"com.linkedin.avro.test","type":"record","fields":[{"name":"astring","type":"string"},{"name":"acomplextype","type":{"type":"long"}},{"name":"arecord","type":{"name":"com.linkedin.avro.innerRecord","type":"record","fields":[{"name":"value","type":"long"}]}}]}
                expected canonical:     {"name":"com.linkedin.avro.test","type":"record","fields":[{"name":"astring","type":"string"},{"name":"acomplextype","type":"long"},{"name":"arecord","type":{"name":"com.linkedin.avro.innerRecord","type":"record","fields":[{"name":"value","type":"long"}]}}]}
FAIL
exit status 1
FAIL    github.com/linkedin/goavro/v2   0.049s

@przemekd
Copy link

przemekd commented Aug 2, 2019

I have created separate issue for logical types bug -> #174

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants