Open joscha opened 5 days ago
logicalTypes
is not a valid BlockDecoder
constructor option. Can you try with parseHook
?
let decoder = new avro.streams.BlockDecoder({
parseHook: (schema) => avro.Type.forSchema(schema, opts),
})
I am actually using the file encoder/decoder methods, the block decoder was just more easy to show a reproduction of. What's the reason this option is not available? Is there a reason not to add and respect it?
On Tue, Oct 22, 2024, 01:28 Matthieu Monsch @.***> wrote:
logicalTypes is not a valid BlockDecoder constructor option. Can you try with parseHook?
let decoder = new avro.streams.BlockDecoder({ parseHook: (schema) => avro.Type.forSchema(schema, opts),})
— Reply to this email directly, view it on GitHub https://github.com/mtth/avsc/issues/489#issuecomment-2427976444, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABN5BRYJCRHNXYHPLVSYBLZ4WLZFAVCNFSM6AAAAABQKREZ5CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMRXHE3TMNBUGQ . You are receiving this because you authored the thread.Message ID: @.***>
parseHook: (schema) => avro.Type.forSchema(schema, opts),
This works, thank you. Still unexpected though.
Given this test:
it shows that the first equals passes (e.g.
b_
is"a-b-c"
). You can test the case where the decoder doesn't know anything about the logical types via:in this case
b__
is"a_b_c"
as that is what is in bufferb
.Now in case of the rest of the test, both
BlockEncoder
andBlockDecoder
receive the sameopts
with the logical types, but theBlockDecoder
still does not apply the logical type, e.g. this test fails with:because the encoded format applied the logical type transformation but the decoder does not apply the inverse. Am I holding it wrong?
references https://github.com/mtth/avsc/issues/471