-
-
Notifications
You must be signed in to change notification settings - Fork 27
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
Deserializing Avro from Google Big Query ( and Logical Type: Datetime) #69
Comments
Hello,
var result = AvroConvert.DeserializeHeadless<List<MyEvent>>(item.AvroRows.SerializedBinaryRows.ToByteArray(), readSession.AvroSchema.Schema)
Thanks, |
Hey Adrian, Please find below a zip with two files:
I also exported an Avro file directly from the Google Cloud console, which may also help: Thank you! |
Hello, I've spotted several issues with your files. First of all, there is no "datetime" logical type according to Avro documentation; Datetime type is often represented as timestamp-millis logical type or simply string. But I wasn't able to deserialize your AvroRows anyway - there are more issues in the AvroModel. But don't worry - bq-sample work perfectly fine. Short tutorial for you, how to deal with Avro data:
var avroBytes = File.ReadAllBytes("bq-sample");
var schema = AvroConvert.GetSchema(avroBytes); That gives you schema in Json format
var avroBytes = File.ReadAllBytes("bq-sample");
var result = AvroConvert.Deserialize<List<Root>>(avroBytes ); Produces a list of 1000 Root items. Hope it helps, |
I'm having trouble deserializing data stored in BigQuery.
For context, BigQuery returns two elements:
AvroSchema
: The schema in JSONAvroRows
: ByteString with multiple rowsI'm trying the following method:
But this only returns one instance of MyEvent. How should I parse a payload that should contain many roads?
Additionally, BigQuery returns
datetime
fields asLogical Type: datetime
that AvroConvert states:System.Runtime.Serialization.SerializationException: 'Unknown LogicalType schema :'datetime'.'
Is there a way to extend AvroConvert to accept this logical type?
I'm not too familiar with Avro and unsure if this is too specific to Google's specification, or something that could be included in AvroConvert.
I'm not sure if there is an issue here at all, or just my misunderstanding of Avro and the ecosystem, and I opened an issue on Google's repo as well, but I thought this could be relevant here as well!
The text was updated successfully, but these errors were encountered: