Mohit
Mohit

Reputation: 151

Logical Datetime is not supported Error when parsing the Avro Schema while reading the data from GCP

I'm getting 'logical datetime is not supported' error when trying to parse the Avro schema. I am fetching data from GCP temp table with the help of ReadSession. Check the code below :

ReadSession rd= new ReadSession();
rd.table = 'mytemptable';
rd.DataFormat = DataFormat.Avro;
ReadSession response = bigqueryclient.CreateReadSession(parent,rd,0)
**var schema = Schema.Parse(response.AvroSchema.Schema);**

--getting error in this line.

Error only coming when the GCP source table is having any column with datatype : datetime otherwise it's working fine. I'm using the latest Avro 1.12 library in .NET 8.

Upvotes: 0

Views: 123

Answers (1)

PUTHINEEDI RAMOJI RAO
PUTHINEEDI RAMOJI RAO

Reputation: 363

If you attempt to export a DATETIME column directly to Avro, it might not be handled appropriately because BigQuery does not have a direct Avro logical type mapping for its DATETIME type and natively supports logical datetime type in Avro. BigQuery usually represents a DATETIME column as an Avro string when exporting it to Avro. Before exporting to Avro, change DATETIME to a supported type in BigQuery, like STRING or TIMESTAMP, to ensure compatibility. For more details you can refer to this documentation.

Upvotes: 1

Related Questions