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

IAvroRows serializedBinaryRows typedef is a Buffer but defined as (Uint8Array|string|null) #335

Open
kitsunde opened this issue Apr 6, 2023 · 5 comments
Assignees
Labels
api: bigquerystorage Issues related to the googleapis/nodejs-bigquery-storage API. priority: p3 Desirable enhancement or fix. May not be included in next release. type: question Request for information or clarification. Not an issue.

Comments

@kitsunde
Copy link

kitsunde commented Apr 6, 2023

Avro's Type.decode expects a Buffer and serializedBinaryRows is a Buffer, but it's defined as (Uint8Array|string|null) which shows up as a type issue.

Presumably either the typedef is missing, or serializedBinaryRows is wrong.

@kitsunde kitsunde added priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Apr 6, 2023
@product-auto-label product-auto-label bot added the api: bigquerystorage Issues related to the googleapis/nodejs-bigquery-storage API. label Apr 6, 2023
@shollyman
Copy link
Contributor

This is a generated API. I'm not familiar with the Avro library you're using, but this sounds like a case where you need to wrap the serialized row data in a buffer before passing it to the Avro decode?

@shollyman shollyman added type: question Request for information or clarification. Not an issue. priority: p3 Desirable enhancement or fix. May not be included in next release. and removed type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. priority: p2 Moderately-important priority. Fix may not be included in next release. labels Apr 6, 2023
@kitsunde
Copy link
Author

kitsunde commented Apr 6, 2023

This is a generated API. I'm not familiar with the Avro library you're using, but this sounds like a case where you need to wrap the serialized row data in a buffer before passing it to the Avro decode?

This is the same library your examples are using but not the actual issue.

The typedef for the property is different from the type of the property. It's defined as UInt8Array in this library, but it is a Buffer when executing.

@kitsunde
Copy link
Author

kitsunde commented Apr 6, 2023

To be clear:

serializedBinaryRows?: (Uint8Array|string|null);

This property is a Buffer when executing not a UInt8Array.

So this

data.avroRows.serializedBinaryRows,
will get highlighted as passing the wrong type because avro.decode expects a Buffer not a UInt8Array and it actually is a Buffer when executing.

@shollyman
Copy link
Contributor

Status: exploring potential annotation changes via internal issue 277340507.

@alvarowolfx
Copy link
Contributor

Those typescript annotations are generated by protobufjs and we apply some fixes in our gax-nodejs tools. I've just opened this PR to apply the fix in our tool as it's faster for us to land those kind of improvements.

googleapis/gax-nodejs#1652

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigquerystorage Issues related to the googleapis/nodejs-bigquery-storage API. priority: p3 Desirable enhancement or fix. May not be included in next release. type: question Request for information or clarification. Not an issue.
Projects
None yet
Development

No branches or pull requests

4 participants