2021年3月5日星期五

BQ load job failing when trying to create table from AVRO file

I am trying to create a BQ Table from AVRO file. I am getting this error when i run the BQ load job:

"Error while reading data, error message: The Apache Avro library failed to parse the header with the following error: Unexpected type for default value. Expected long, but found null: null"

The Schema of the AVRO file is:

{    "type" : "record",    "name" : "Pair",    "namespace" : "org.apache.avro.mapred",    "fields" : [ {      "name" : "key",      "type" : "int",      "doc" : ""    }, {      "name" : "value",      "type" : {        "type" : "record",        "name" : "CustomerInventoryOrderItems",        "namespace" : "com.test.customer.order",        "fields" : [ {          "name" : "updated_at",          "type" : "long"        }, {          "name" : "inventory_order_items",          "type" : {            "type" : "map",            "values" : {              "type" : "array",              "items" : {                "type" : "record",                "name" : "CustomerInventoryOrderItem",                "fields" : [ {                  "name" : "order_item_id",                  "type" : "int",                  "default" : null                }, {                  "name" : "updated_at",                  "type" : "long"                }, {                  "name" : "created_at",                  "type" : "long"                }, {                  "name" : "product_id",                  "type" : [ "null", "int" ],                  "default" : null                }, {                  "name" : "type_id",                  "type" : "int",                  "default" : null                }, {                  "name" : "event_id",                  "type" : [ "null", "int" ],                  "default" : null                }, {                  "name" : "price",                  "type" : [ "null", "double" ],                  "default" : null                }, {                  "name" : "tags",                  "type" : [ "null", "string" ],                  "default" : null                }, {                  "name" : "estimated_ship_date",                  "type" : [ "null", "long" ],                  "default" : null                } ]              }            }          }        } ]      },      "doc" : "",      "order" : "ignore"    } ]  }  

I am not sure what is wrong with the schema or anything else, because of which I am unable to load the data.

https://stackoverflow.com/questions/66501393/bq-load-job-failing-when-trying-to-create-table-from-avro-file March 06, 2021 at 09:06AM

没有评论:

发表评论